cuepointthekid

Untitled

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