Jere564445

Moon Bunny

Aug 7th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.03 KB | None | 0 0
  1.  
  2. local ply = game.Players.LocalPlayer
  3. char = ply.Character
  4. torso = char.Torso
  5. head = char.Head
  6. holding = false
  7. RS = game:service'RunService'
  8. rarm,larm = char['Left Arm'],char['Right Arm']
  9. Debris = game:service'Debris'
  10.  
  11. pcall(function() ply.Backpack.Moonbunny:Destroy() end) --- Destroys Tool
  12. hop = Instance.new("HopperBin",ply.Backpack)
  13. hop.Name = 'Moonbunny'
  14. FFS = function(A,B) A:FindFirstChild(B) end ---- FindFirstChild Shortcut
  15.  
  16. pcall(function() char.Sole:Destroy() end) --- Destroys Physical Tool
  17. Weapon = Instance.new("Model",char) Weapon.Name = 'Sole'
  18. cfn,ang,md,mr = CFrame.new,CFrame.Angles,math.rad,math.random --- Some Shortcuts
  19.  
  20. for i,v in pairs(head:children()) do
  21. if v.Name == 'MugSound' then v:Destroy() end
  22. end
  23.  
  24. rw,lw = _,_
  25.  
  26. ---TOOLS---
  27. Add ={ --- Array for handy functions
  28. BG = function(parent)
  29. local bg = Instance.new("BodyGyro",parent)
  30. bg.P = 20e+003
  31. bg.maxTorque = Vector3.new(4e+005,4e+005,4e+005)*math.huge
  32. return bg
  33. end;
  34. BP = function(parent,position)
  35. local bp = Instance.new("BodyPosition",parent)
  36. bp.maxForce = Vector3.new()*math.huge
  37. bp.position = position or parent.Position
  38. return bp
  39. end;
  40. BV = function(parent,force)
  41. local bv = Instance.new("BodyVelocity",parent)
  42. bv.maxForce = Vector3.new()*math.huge
  43. bv.velocity = force
  44. return bv
  45. end;
  46. Sound = function(id,pitch,parent)
  47. local tab = setmetatable({},{
  48. __call = function(t,param) cl = t[1]:Clone() cl.Parent = param return cl end
  49. })
  50. local snd = Instance.new("Sound",char.Head)
  51. snd.Name = 'MugSound'
  52. snd.SoundId = id
  53. snd.Pitch = pitch
  54. table.insert(tab,snd)
  55. function tab:Play()
  56. self[1]:Play()
  57. end
  58. return tab
  59. end;
  60. }
  61. Meshes = {Diamond = 'rbxassetid://9756362'; Spikeball = 'rbxassetid://9982590'; --- MeshIds
  62. Egg = 'rbxassetid://1527559'; Ring = 'rbxassetid://3270017';}
  63. Part = function(x,y,z,color,tr,parent)
  64. local p = Instance.new((tr ~= 1 and 'Part' or 'WedgePart'),parent or Weapon)
  65. p.formFactor = 'Custom'
  66. p.Size = Vector3.new(x,y,z)
  67. p.BrickColor = BrickColor.new(color)
  68. p.CanCollide = false
  69. p.TopSurface,p.BottomSurface = 0,0
  70. return p
  71. end
  72. Mesh = function(par,num,x,y,z)
  73. local msh = _
  74. if num == 1 then msh = Instance.new("CylinderMesh",par)
  75. elseif num == 2 then msh = Instance.new("SpecialMesh",par) msh.MeshType = 3
  76. elseif num == 3 then msh = Instance.new("BlockMesh",par)
  77. elseif type(num) == 'string' then msh = Instance.new("SpecialMesh",par) msh.MeshId = num
  78. end
  79. msh.Scale = Vector3.new(x,y,z)
  80. return msh
  81. end
  82. Weld = function(p0,p1,x,y,z,rx,ry,rz,par)
  83. p0.Position = p1.Position
  84. local w = Instance.new('Motor',par or p0)
  85. w.Part0 = p0
  86. w.Part1 = p1
  87. w.C1 = CFrame.new(x,y,z)*CFrame.Angles(rx,ry,rz)
  88. return w
  89. end
  90. Lock = function(which) --- For using Animation
  91. local result = {rw=false,lw=false}
  92. if which == 'R' then
  93. if not rw then
  94. rabr = Part(1,1,1,'White',0) rabr.Transparency = 1
  95. rabr.Position = torso.Position
  96. rw = Weld(rabr,torso,1.5,.5,0,0,0,0) rw.Parent = Weapon
  97. w = Instance.new("Weld",Weapon)
  98. w.Part0,w.Part1 = char['Right Arm'],rabr
  99. w.C1 = CFrame.new(0,-.5,0)
  100. else
  101. rabr:Destroy()
  102. rw = _
  103. end
  104. elseif which == 'L' then
  105. if not lw then
  106. labr = Part(1,1,1,'White',0) labr.Transparency = 1
  107. labr.Position = torso.Position
  108. lw = Weld(labr,torso,-1.5,.5,0,0,0,0) lw.Parent = Weapon
  109. w = Instance.new("Weld",Weapon)
  110. w.Part0,w.Part1 = char['Left Arm'],labr
  111. w.C1 = CFrame.new(0,-.5,0)
  112. else
  113. labr:Destroy()
  114. lw = _
  115. end
  116. elseif which == _ then
  117. if rw then result.rw = true end
  118. if lw then result.lw = true end
  119. end
  120. return result
  121. end
  122. tw = function(Weld, Stop, Step,a) --- TweenWeld function
  123. local func = function()
  124. local Start = Weld.C0
  125. local X1, Y1, Z1 = Start:toEulerAnglesXYZ()
  126. local Stop = Stop
  127. local X2, Y2, Z2 = Stop:toEulerAnglesXYZ()
  128.  
  129. for i = 0, 1, Step or .1 do
  130. Weld.C0 = CFrame.new( (Start.p.X * (1 - i)) + (Stop.p.X * i),
  131. (Start.p.Y * (1 - i)) + (Stop.p.Y * i),
  132. (Start.p.Z * (1 - i)) + (Stop.p.Z * i)) * CFrame.fromEulerAnglesXYZ(
  133. (X1 * (1 - i)) + (X2 * i), (Y1 * (1 - i)) + (Y2 * i),
  134. (Z1 * (1 - i)) + (Z2 * i) )
  135. wait()
  136. end
  137.  
  138. Weld.C0 = Stop
  139. end
  140. if a then coroutine.wrap(function() func() end)() else func() end
  141. end
  142. SFX = {
  143. Ring = function(cf,radius,color,snd) -- Effect used when starting flying (default radius 30)
  144. local ring = Part(1,1,1,color or 'New Yeller',0) ring.Anchored = true
  145. local msh = Mesh(ring,Meshes.Ring,1,1,1)
  146. ring.CFrame = cf
  147. if snd then snd:Play() elseif snd == _ then Whine_snd:Play() end
  148. coroutine.wrap(function()
  149. for i = 1,radius or 30 do wait()
  150. msh.Scale = Vector3.new(i,i,1)
  151. ring.Transparency = i/(radius or 30)
  152. end
  153. ring:Destroy()
  154. end)()
  155. end;
  156. Sphere = function(cf,color,radius)
  157. local ball = Part(1,1,1,color,0) ball.Anchored = true
  158. ball.CFrame = cf
  159. local msh = Mesh(ball,2,1,1,1)
  160. coroutine.wrap(function()
  161. for i = 1,radius do wait()
  162. wait()
  163. msh.Scale = Vector3.new(i,i,i)
  164. ball.Transparency = i/radius
  165. end
  166. ball:Destroy() end)();
  167. end;
  168. }
  169. -----------
  170.  
  171. --SOUNDS--
  172. Whine_snd = Add.Sound("http://www.roblox.com/Asset/?id=3264923",1)
  173. Swing_snd = Add.Sound("http://www.roblox.com/Asset/?id=10209645",1)
  174. Boom_snd = Add.Sound("http://www.roblox.com/Asset/?id=3087031",2.5)
  175. Fire_snd = Add.Sound("http://www.roblox.com/Asset/?id=2760979",1)
  176. Hit_snd = Add.Sound("http://www.roblox.com/Asset/?id=2785493",1) Hit_snd.Volume = 120
  177. ----------
  178.  
  179. ---EARS---
  180. p = Part(1,2,.5,'White',0)
  181. Weld(p,head,.8,1.25,0,0,0,md(-30))
  182. Mesh(p,2,1,1,1)
  183. p2 = Part(.8,1.8,.4,'Pink',0)
  184. Weld(p2,p,0,-.1,-.1,0,0,0)
  185. Mesh(p2,2,1,1,1)
  186.  
  187. p = Part(1,2,.5,'White',0)
  188. Weld(p,head,-.8,1.25,0,0,0,md(30))
  189. Mesh(p,2,1,1,1)
  190. p2 = Part(.8,1.8,.4,'Pink',0)
  191. Weld(p2,p,0,-.1,-.1,0,0,0)
  192. Mesh(p2,2,1,1,1)
  193. ----------
  194.  
  195. function Clear() ---- Removes Eggs
  196. for i,v in pairs(EggList) do v:Destroy() end
  197. EggList = {}
  198. end
  199.  
  200. EggList = {} --- Contains Eggs
  201. function SpawnEgg() ---- Spawn's Egg
  202. local egg = Part(10,10,10,'Black',0) egg.CanCollide = true
  203. egg.Shape = 0
  204. egg.CFrame = torso.CFrame*cfn(0,0,6)
  205. msh = Mesh(egg,Meshes.Egg,4,4,4) msh.TextureId = 'http://www.roblox.com/asset/?id=57202933'
  206. egg.Elasticity = 1
  207. egg.Friction = 0
  208. egg.RotVelocity = Vector3.new(40,-30,40)
  209. egg.Touched:connect(function(hit)
  210. local hum = hit.Parent:FindFirstChild('Humanoid')
  211. if hum and hum.Parent ~= char then
  212. egg.Velocity = cfn(hum.Torso.Position,egg.Position).lookVector*-300
  213. msh.VertexColor = Vector3.new(1,0,0)
  214. wait(.1)
  215. msh.VertexColor = Vector3.new(1,1,1)
  216. else
  217. egg.Velocity = Vector3.new(math.random(-10,10),30,math.random(-10,10))
  218. egg.RotVelocity = Vector3.new(0,0,100)
  219. end
  220. end)
  221. table.insert(EggList,egg)
  222. end
  223.  
  224. bp = _
  225. last_atk = 0
  226.  
  227. flying = false
  228. function Float() --- Floating function
  229. if bp and not flying then bp:Destroy() bp = _ Lock'R' Lock'L' return end --- Stops Floating
  230. local function CheckHeight() local result = _ --- Check's height from nearest object
  231. local r = Ray.new(torso.Position,Vector3.FromNormalId(Enum.NormalId.Bottom)*500)
  232. local o,p = Workspace:FindPartOnRay(r,char)
  233. if o and p then
  234. result = (torso.Position-p).magnitude
  235. end
  236. return result
  237. end
  238. jumping = char.Humanoid.Jump
  239.  
  240. t = RS.Stepped:wait()
  241. if (t - last_atk < .5 and not bp) or ((CheckHeight() == _ or CheckHeight() > 5) and not bp) then --- Logic
  242. bp = Add.BP(torso)
  243. Lock'R' Lock'L' rw.C0 = FloatingR lw.C0 = FloatingL
  244. end
  245.  
  246. last_atk = t
  247. end
  248.  
  249. flying = false
  250. FloatingR = cfn()*ang(0,0,md(-22.5))
  251. FloatingL = cfn()*ang(0,0,md(22.5))
  252. function Fly(mouse) --- Flying function
  253. if bp then
  254. local bg = Add.BG(torso)
  255. rw.C0 = cfn()*ang(md(50),md(-45),0) lw.C0 = cfn()*ang(md(50),md(45),0)
  256. flying = true
  257. Delay(.1,function() SFX.Ring( (torso.CFrame*cfn(0,-4,0))*ang(math.pi/2,0,0) ) end)
  258. while (flying and bp) do wait()
  259. bp.position = torso.Position+(torso.Position-mouse.hit.p).unit*-10
  260. bg.cframe = cfn(torso.Position,mouse.hit.p)*ang(md(-20),0,0)
  261. end
  262. flying = false
  263. bg:Destroy()
  264. rw.C0 = FloatingR lw.C0 = FloatingL
  265. end
  266. end
  267.  
  268. function EggNoJutsu(mouse)
  269. if not rw and not lw then Lock'R' Lock'L' end
  270. holding = true
  271. local bg = Add.BG(torso)
  272. coroutine.wrap(function()
  273. while holding do wait()
  274. if bp then bg.cframe = cfn(torso.Position,mouse.hit.p)
  275. else bg.cframe = cfn(torso.Position,Vector3.new(mouse.hit.p.x,torso.Position.y,mouse.hit.p.z))
  276. end
  277. end
  278. bg:Destroy()
  279. end)()
  280. while holding do
  281. for i = 1,30 do wait() Swing_snd:Play()
  282. rw.C0 = cfn()*ang(md(-mr(50,150)),-md(40),0)
  283. lw.C0 = cfn()*ang(md(-mr(50,150)),md(40),0)
  284. end
  285. SFX.Ring((torso.CFrame*cfn(0,0,-5)),50,'Pink',Boom_snd)
  286. rw.C0 = cfn()*ang(md(-80),md(45),0) lw.C0 = cfn()*ang(md(-80),md(-45),0)
  287. local p = Part(10,10,10,'Black',0) p:BreakJoints()
  288. Mesh(p,Meshes.Egg,5,5,5).TextureId = 'http://www.roblox.com/asset/?id=7958793'
  289. p.CFrame = (torso.CFrame*cfn(0,0,-15))*ang(-math.pi/2,0,0)
  290. Add.BV(p,torso.CFrame.lookVector*300)
  291. p.Touched:connect(function(hit)
  292. if not bp then if hit.Name == 'Base' then return end end
  293. e = Instance.new("Explosion",Workspace)
  294. e.BlastPressure = 0
  295. e.BlastRadius = 100
  296. e.Position = p.Position
  297. p:Destroy()
  298. end)
  299. Debris:AddItem(p,5)
  300. wait(1)
  301. end
  302. if bp and not flying then
  303. rw.C0 = FloatingR lw.C0 = FloatingL
  304. else Lock'R' Lock'L'
  305. end
  306. end
  307.  
  308. r = 5
  309. last_shot = 0
  310. bg2 = _
  311. function Shoot(mouse) attacking = false
  312. Lock'R'
  313. bg2 = Add.BG(torso)
  314. bg2.cframe = cfn(torso.Position,mouse.hit.p)*ang(0,math.pi/2,0)
  315. tw(rw,cfn()*ang(-math.pi/2,math.pi/2,0),.3)
  316. Fire_snd:Play()
  317.  
  318. ---ATT1---
  319.  
  320. for i = -80,80,20 do
  321. local p = Part(1,1,1,'Bright red',0)
  322. p.Transparency = i == 0 and 0 or .5
  323. Mesh(p,Meshes.Egg,1,1,1)
  324. p.CFrame = (torso.CFrame*cfn(5,0,0))*cfn(math.cos(md(i))*r,0,math.sin(md(i))*r)
  325. p.CFrame = cfn(p.Position,torso.Position)*ang(math.pi/2,0,0)
  326. p.Touched:connect(function() SFX.Sphere(p.CFrame,'Bright red',30) Hit_snd(p):Play() p:Destroy() end)
  327. Add.BV(p,(p.CFrame*ang(math.pi/2,0,0)).lookVector*30)
  328. p:BreakJoints()
  329. Debris:AddItem(p,3)
  330. end
  331.  
  332. t = RS.Stepped:wait()
  333.  
  334. if (t-last_shot < .2) then attacking = true
  335. bg2.cframe = cfn(torso.Position,mouse.hit.p)*ang(0,math.pi/2,0)
  336. local p = Part(1,1,1,'Bright red',0)
  337. p.Transparency = i == 0 and 0 or .5
  338. Mesh(p,Meshes.Egg,3,3,3)
  339. p.CFrame = (torso.CFrame*cfn(5,0,0))
  340. p.CFrame = cfn(p.Position,torso.Position)*ang(math.pi/2,0,0)
  341. p.Touched:connect(function() SFX.Sphere(p.CFrame,'Bright red',30) Hit_snd(p):Play() p:Destroy() end)
  342. Add.BV(p,(p.CFrame*ang(math.pi/2,0,0)).lookVector*30)
  343. p:BreakJoints()
  344. Debris:AddItem(p,3)
  345. wait(1)
  346. end
  347. wait(.25)
  348.  
  349. bg2:Destroy() bg2 = _
  350. Lock'R'
  351. last_shot = t
  352. end
  353.  
  354.  
  355. klist = { --- Key Bindings
  356. f = SpawnEgg;
  357. r = Clear;
  358. eq = function(mouse) EggNoJutsu(mouse) end;
  359. q = function(mouse) Shoot(mouse) end;
  360. [string.char(32)] = Float; --- 32 is Space
  361. }
  362.  
  363. hop.Selected:connect(function(mouse) --- Connections
  364. mouse.Button1Down:connect(function() Fly(mouse) end)
  365. mouse.Button1Up:connect(function() flying = false end)
  366. mouse.KeyUp:connect(function(key) for i,v in pairs(klist) do if key == i:sub(1,1) and i:sub(2,2) == 'q' then holding = false end end end)
  367. mouse.KeyDown:connect(function(key)
  368. if attacking then return end
  369. for i,v in pairs(klist) do
  370. if key == i:sub(1,1) then attacking = true v(mouse) attacking = false end
  371. end
  372. end)
  373. end)
  374.  
  375. prev_step = 0
  376. while wait() do --- Effect Loop
  377. t = RS.Stepped:wait()
  378. if not flying and bp then
  379. local p = Part(2,2,2,'White',0)
  380. p.Anchored = true p.Transparency = .5
  381. p.CFrame = (torso.CFrame*cfn(0,-5,0))*ang(math.random(-3,3),math.random(-3,3),math.random(-3,3))
  382. Delay(.1,function() for i = .5,1,.1 do wait() p.Transparency = i end p:Destroy() end)
  383. elseif bp and flying then
  384. local p = Part(2,2,2,'Deep blue',0)
  385. p.Anchored = true p.Transparency = .5
  386. p.CFrame = (torso.CFrame*cfn(0,-5,0))
  387. Delay(.1,function() for i = .5,1,.1 do wait() p.Transparency = i end p:Destroy() end)
  388. end
  389. prevstep = t
  390. end
Add Comment
Please, Sign In to add comment