DarkLord732

Banana

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