ethan15864

bannana

May 16th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Plrs = game:GetService("Players")
  2. me = Plrs.LocalPlayer
  3. char = me.Character
  4. Modelname = "xBananaz"
  5. Toolname = "Banana"
  6. Surfaces = {"FrontSurface", "BackSurface", "TopSurface", "BottomSurface", "LeftSurface", "RightSurface"}
  7. necko = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  8. selected = false
  9. Able = true
  10. Prop = {Damage = 30}
  11.  
  12. ToolIcon = ""
  13. MouseIc = ""
  14. MouseDo = ""
  15.  
  16. function Notime(func, tim)
  17. coroutine.resume(coroutine.create(function()
  18. if tim then
  19. wait(tim)
  20. end
  21. func()
  22. end))
  23. end
  24.  
  25. Add = {
  26. Sphere = function(P)
  27. local m = Instance.new("SpecialMesh",P)
  28. m.MeshType = "Sphere"
  29. return m
  30. end,
  31. BF = function(P)
  32. local bf = Instance.new("BodyForce",P)
  33. bf.force = Vector3.new(0, P:GetMass()*187, 0)
  34. return bf
  35. end,
  36. BP = function(P)
  37. local bp = Instance.new("BodyPosition",P)
  38. bp.maxForce = Vector3.new(math.huge, 0, math.huge)
  39. bp.P = 14000
  40. return bp
  41. end,
  42. BG = function(P)
  43. local bg = Instance.new("BodyGyro",P)
  44. bg.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  45. bg.P = 14000
  46. return bg
  47. end,
  48. Mesh = function(P, ID, x, y, z)
  49. local m = Instance.new("SpecialMesh")
  50. m.MeshId = ID
  51. m.Scale = Vector3.new(x, y, z)
  52. m.Parent = P
  53. return m
  54. end,
  55. Sound = function(P, ID, vol, pitch)
  56. local s = Instance.new("Sound")
  57. s.SoundId = ID
  58. s.Volume = vol
  59. s.Pitch = pitch
  60. s.Parent = P
  61. return s
  62. end
  63. }
  64.  
  65. function find(tab, arg)
  66. local ah = nil
  67. for i,v in pairs(tab) do
  68. if v == arg then
  69. ah = v
  70. end
  71. end
  72. return ah
  73. end
  74.  
  75. function getAllParts(from)
  76. local t = {}
  77. function getParts(where)
  78. for i, v in pairs(where:children()) do
  79. if v:IsA("BasePart") then
  80. if v.Parent ~= char and v.Parent.Parent ~= char then
  81. table.insert(t, v)
  82. end
  83. end
  84. getParts(v)
  85. end
  86. end
  87. getParts(workspace)
  88. return t
  89. end
  90.  
  91. function RayCast(pos1, pos2, maxDist, forward)
  92. local list = getAllParts(workspace)
  93. local pos0 = pos1
  94. for dist = 1, maxDist, forward do
  95. pos0 = (CFrame.new(pos1, pos2) * CFrame.new(0, 0, -dist)).p
  96. for _, v in pairs(list) do
  97. local pos3 = v.CFrame:pointToObjectSpace(pos0)
  98. local s = v.Size
  99. if pos3.x > -(s.x/2) and pos3.x < (s.x/2) and pos3.y > -(s.y/2) and pos3.y < (s.y/2) and pos3.z > -(s.z/2) and pos3.x < (s.z/2) and v.CanCollide == true then
  100. return pos0, v
  101. end
  102. end
  103. end
  104. return pos0, nil
  105. end
  106.  
  107. function Part(Parent, Anchor, Collide, Tran, Ref, Color, X, Y, Z, Break)
  108. local p = Instance.new("Part")
  109. p.formFactor = "Custom"
  110. p.Anchored = Anchor
  111. p.CanCollide = Collide
  112. p.Transparency = Tran
  113. p.Reflectance = Ref
  114. p.BrickColor = BrickColor.new(Color)
  115. for _, Surf in pairs(Surfaces) do
  116. p[Surf] = "Smooth"
  117. end
  118. p.Size = Vector3.new(X, Y, Z)
  119. if Break then
  120. p:BreakJoints()
  121. else p:MakeJoints() end
  122. p.Parent = Parent
  123. return p
  124. end
  125.  
  126. function Weld(p0, p1, x, y, z, a, b, c)
  127. local w = Instance.new("Weld")
  128. w.Parent = p0
  129. w.Part0 = p0
  130. w.Part1 = p1
  131. w.C1 = CFrame.new(x,y,z) * CFrame.Angles(a,b,c)
  132. return w
  133. end
  134.  
  135. function ComputePos(pos1, pos2)
  136. local pos3 = Vector3.new(pos2.x, pos1.y, pos2.z)
  137. return CFrame.new(pos1, pos3)
  138. end
  139.  
  140. function getHumanoid(c)
  141. local h = nil
  142. for i,v in pairs(c:children()) do
  143. if v:IsA("Humanoid") then
  144. if v.Health > 0 then
  145. h = v
  146. end
  147. end
  148. end
  149. return h
  150. end
  151.  
  152. for i,v in pairs(char:children()) do
  153. if v.Name == Modelname then
  154. v:remove()
  155. end
  156. end
  157.  
  158. torso = char.Torso
  159. neck = torso.Neck
  160. hum = char.Humanoid
  161. Rarm = char["Right Arm"]
  162. Larm = char["Left Arm"]
  163. Rleg = char["Right Leg"]
  164. Lleg = char["Left Leg"]
  165.  
  166. hc = Instance.new("Humanoid")
  167. hc.Health = 0
  168. hc.MaxHealth = 0
  169.  
  170. slash = Add.Sound(nil, "rbxasset://sounds//swordslash.wav", 0.9, 0.8)
  171. hitsound = Add.Sound(nil, "http://www.roblox.com/asset/?id=2801263", 0.7, 0.6)
  172. charge = Add.Sound(nil, "http://www.roblox.com/asset/?id=2101137", 0.8, 0.65)
  173. boom = Add.Sound(nil, "http://www.roblox.com/asset/?id=2691586", 0.8, 0.3)
  174. smashsound = Add.Sound(nil, "http://www.roblox.com/asset/?id=2692806", 0.8, 0.35)
  175. boomboom = Add.Sound(nil, "http://www.roblox.com/asset/?id=2760979", 1, 0.18)
  176.  
  177. function PlaySound(sound, pitch, vol)
  178. local s = sound:clone()
  179. if pitch ~= nil then
  180. if tonumber(pitch) then
  181. s.Pitch = tonumber(pitch)
  182. end
  183. end
  184. if vol ~= nil then
  185. if tonumber(vol) then
  186. s.Volume = tonumber(vol)
  187. end
  188. end
  189. s.Parent = torso
  190. s.PlayOnRemove = true
  191. coroutine.resume(coroutine.create(function()
  192. wait()
  193. s:remove()
  194. end))
  195. end
  196.  
  197. Mo = Instance.new("Model")
  198. Mo.Name = Modelname
  199.  
  200. RABrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  201. LABrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  202. RLBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  203. LLBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  204.  
  205. RABW = Weld(torso, RABrick, -1.5, -0.5, 0, 0, 0, 0)
  206. LABW = Weld(torso, LABrick, 1.5, -0.5, 0, 0, 0, 0)
  207. RLBW = Weld(torso, RLBrick, -0.5, 1.2, 0, 0, 0, 0)
  208. LLBW = Weld(torso, LLBrick, 0.5, 1.2, 0, 0, 0, 0)
  209.  
  210. RAW = Weld(RABrick, nil, 0, 0.5, 0, 0, 0, 0)
  211. LAW = Weld(LABrick, nil, 0, 0.5, 0, 0, 0, 0)
  212. RLW = Weld(RLBrick, nil, 0, 0.8, 0, 0, 0, 0)
  213. LLW = Weld(LLBrick, nil, 0, 0.8, 0, 0, 0, 0)
  214.  
  215. HB = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  216. HBW = Weld(Rarm, HB, 0, 1, 0, 0, 0, 0)
  217. HW = Weld(HB, nil, 0, 0.3, 0, math.pi/2, math.pi, 0)
  218.  
  219. Mo.Parent = char
  220.  
  221. function MakeBanana()
  222. local Banana = Part(workspace, false, true, 0, 0, "Bright yellow", 0.9, 0.95, 0.9, true)
  223. Banana.Friction = 0.8
  224. Banana.Elasticity = 0
  225. local mes = Add.Mesh(Banana, "http://www.roblox.com/asset/?id=28937301", 1.3, 0.8, 1.3)
  226. mes.TextureId = "http://www.roblox.com/asset/?id=28937670"
  227. HW.Part1 = Banana
  228. return Banana
  229. end
  230.  
  231. if script.Parent.className ~= "HopperBin" then
  232. h = Instance.new("HopperBin",me.Backpack)
  233. h.Name = Toolname
  234. h.TextureId = ToolIcon
  235. script.Parent = h
  236. end
  237.  
  238. bin = script.Parent
  239.  
  240. function detach(bool)
  241. LLW.C0 = CFrame.new(0, 0, 0)
  242. RLW.C0 = CFrame.new(0, 0, 0)
  243. LAW.C0 = CFrame.new(0,0,0)
  244. RAW.C0 = CFrame.new(0, 0, 0)
  245. if bool then
  246. LLW.Part1 = nil
  247. RLW.Part1 = nil
  248. RAW.Part1 = nil
  249. LAW.Part1 = nil
  250. end
  251. end
  252.  
  253. function attach()
  254. RAW.Part1 = Rarm
  255. LAW.Part1 = Larm
  256. RLW.Part1 = Rleg
  257. LLW.Part1 = Lleg
  258. end
  259.  
  260. function normal()
  261. neck.C0 = NeckStand
  262. RAW.C0 = RAWStand
  263. LAW.C0 = LAWStand
  264. RLW.C0 = RLWStand
  265. LLW.C0 = LLWStand
  266. RAW.C1 = CFrame.new(0, 0.5, 0)
  267. LAW.C1 = CFrame.new(0, 0.5, 0)
  268. RLW.C1 = CFrame.new(0, 0.8, 0)
  269. LLW.C1 = CFrame.new(0, 0.8, 0)
  270. HW.C0 = HWStand
  271. end
  272.  
  273. function throw(mousepos)
  274. RAW.Part1 = Rarm
  275. for i = 0, 1, 0.2 do
  276. RAW.C0 = CFrame.Angles(math.rad(-5*i), 0, math.rad(-15*i)) * CFrame.new(0, -0.2*i, -0.5*i)
  277. wait()
  278. end
  279. local banana = MakeBanana()
  280. for i = 0, 1, 0.14 do
  281. RAW.C0 = CFrame.Angles(math.rad(-5+185*i), 0, math.rad(-15+35*i)) * CFrame.new(0, -0.2+0.1*i, -0.5+0.8*i)
  282. wait()
  283. end
  284. for i = 0, 1, 0.25 do
  285. RAW.C0 = CFrame.Angles(math.rad(-5+185-90*i), 0, math.rad(-15+35-45*i)) * CFrame.new(0, -0.2+0.1-0.4*i, -0.5+0.8-0.3*i)
  286. wait()
  287. end
  288. local pos = CFrame.new(banana.Position, mousepos) * CFrame.Angles(math.rad(25),0,0)
  289. local mag = (torso.Position - mousepos).magnitude
  290. mag = mag - (mag/5)
  291. if mag > 25 then mag = 25 end
  292. local kert = (40+(mag*2))
  293. Notime(function()
  294. HW.Part1 = nil
  295. wait()
  296. banana.Velocity = pos.lookVector * kert
  297. local bg = Add.BG(banana)
  298. bg.P = 4500
  299. bg.maxTorque = Vector3.new(math.huge, 0, math.huge)
  300. wait(0.5)
  301. repeat wait() until banana.Velocity.magnitude < 13
  302. local ablez = true
  303. local con = banana.Touched:connect(function(hit)
  304. local hu = getHumanoid(hit.Parent)
  305. if hu then
  306. local to = hu.Parent:findFirstChild("Torso")
  307. if to and ablez then
  308. ablez = false
  309. local bg = Add.BG(to)
  310. hu.PlatformStand = true
  311. local cf1 = to.CFrame
  312. local cf2 = CFrame.new(cf1.p, (cf1 * CFrame.new(0, 0, -2).p))
  313. to.Velocity = to.Velocity + (cf1.lookVector * -15) + Vector3.new(0, 35, 0)
  314. local ah = math.random(260,280)
  315. local mm = math.random(5,8)/100
  316. Notime(function()
  317. wait(0.25)
  318. ablez = true
  319. end)
  320. banana.Velocity = cf1.lookVector * 35
  321. for i = 0, 1, mm do
  322. bg.cframe = cf2 * CFrame.Angles(math.rad(ah*i), 0, 0)
  323. wait()
  324. end
  325. wait()
  326. bg:remove()
  327. wait(0.4)
  328. hu.PlatformStand = false
  329. end
  330. end
  331. end)
  332. wait(math.random(18,22))
  333. con:disconnect()
  334. for i = 0, 1, 0.033 do
  335. banana.Transparency = i
  336. wait()
  337. end
  338. banana:remove()
  339. end)
  340. for i = 0, 1, 0.16 do
  341. RAW.C0 = CFrame.Angles(math.rad(-5+185-90-90*i), 0, math.rad(-15+35-45+25*i)) * CFrame.new(0, -0.2+0.1-0.4+0.5*i, 0)
  342. wait()
  343. end
  344. detach(true)
  345. end
  346.  
  347. function select(mouse)
  348. selected = true
  349. mouse.Button1Down:connect(function()
  350. if Able then
  351. Able = false
  352. throw(mouse.Hit.p)
  353. wait(0.5)
  354. Able = true
  355. end
  356. end)
  357. end
  358.  
  359. function deselect(mouse)
  360. selected = false
  361. end
  362.  
  363. bin.Selected:connect(select)
  364. bin.Deselected:connect(deselect)
Add Comment
Please, Sign In to add comment