Advertisement
HenloMyDude

sonic the hedgehog

Aug 14th, 2019
641
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.51 KB | None | 0 0
  1. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  2. local Player,game,owner = owner,game
  3. local RealPlayer = Player
  4. do
  5. print("FE Compatibility code by Mokiros, Edited by StarzoZero")
  6. local rp = RealPlayer
  7. script.Parent = rp.Character
  8.  
  9. --RemoteEvent for communicating
  10. local Event = Instance.new("RemoteEvent")
  11. Event.Name = "UserInput_Event"
  12.  
  13. --Fake event to make stuff like Mouse.KeyDown work
  14. local function fakeEvent()
  15. local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
  16. t.connect = t.Connect
  17. return t
  18. end
  19.  
  20. --Creating fake input objects with fake variables
  21. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  22. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  23. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  24. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  25. end}
  26. --Merged 2 functions into one by checking amount of arguments
  27. CAS.UnbindAction = CAS.BindAction
  28.  
  29. --This function will trigger the events that have been :Connect()'ed
  30. local function te(self,ev,...)
  31. local t = m[ev]
  32. if t and t._fakeEvent then
  33. for _,f in pairs(t.Functions) do
  34. f(...)
  35. end
  36. end
  37. end
  38. m.TrigEvent = te
  39. UIS.TrigEvent = te
  40.  
  41. Event.OnServerEvent:Connect(function(plr,io)
  42. if plr~=rp then return end
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. if not io.isMouse then
  46. local b = io.UserInputState == Enum.UserInputState.Begin
  47. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  48. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  49. end
  50. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  51. return m:TrigEvent(b and "Button2Down" or "Button2Up")
  52. end
  53. for _,t in pairs(CAS.Actions) do
  54. for _,k in pairs(t.Keys) do
  55. if k==io.KeyCode then
  56. t.Function(t.Name,io.UserInputState,io)
  57. end
  58. end
  59. end
  60. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  61. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  62. end
  63. end)
  64. Event.Parent = NLS([==[
  65. local Player = game:GetService("Players").LocalPlayer
  66. local Event = script:WaitForChild("UserInput_Event")
  67. local Mouse = Player:GetMouse()
  68. local UIS = game:GetService("UserInputService")
  69. local input = function(io,a)
  70. if a then return end
  71. --Since InputObject is a client-side instance, we create and pass table instead
  72. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  73. end
  74. UIS.InputBegan:Connect(input)
  75. UIS.InputEnded:Connect(input)
  76. local h,t
  77. --Give the server mouse data 30 times every second, but only if the values changed
  78. --If player is not moving their mouse, client won't fire events
  79. while wait(1/30) do
  80. if h~=Mouse.Hit or t~=Mouse.Target then
  81. h,t=Mouse.Hit,Mouse.Target
  82. Event:FireServer({isMouse=true,Target=t,Hit=h})
  83. end
  84. end]==],Player.Character)
  85.  
  86. ----Sandboxed game object that allows the usage of client-side methods and services
  87. --Real game object
  88. local _rg = game
  89.  
  90. --Metatable for fake service
  91. local fsmt = {
  92. __index = function(self,k)
  93. local s = rawget(self,"_RealService")
  94. if s then
  95. return typeof(s[k])=="function"
  96. and function(_,...)return s[k](s,...)end or s[k]
  97. end
  98. end,
  99. __newindex = function(self,k,v)
  100. local s = rawget(self,"_RealService")
  101. if s then s[k]=v end
  102. end
  103. }
  104. local function FakeService(t,RealService)
  105. t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
  106. return setmetatable(t,fsmt)
  107. end
  108.  
  109. --Fake game object
  110. local g = {
  111. GetService = function(self,s)
  112. return rawget(self,s) or _rg:GetService(s)
  113. end,
  114. Players = FakeService({
  115. LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
  116. },"Players"),
  117. UserInputService = FakeService(UIS,"UserInputService"),
  118. ContextActionService = FakeService(CAS,"ContextActionService"),
  119. RunService = FakeService({
  120. _btrs = {},
  121. RenderStepped = _rg:GetService("RunService").Heartbeat,
  122. BindToRenderStep = function(self,name,_,fun)
  123. self._btrs[name] = self.Heartbeat:Connect(fun)
  124. end,
  125. UnbindFromRenderStep = function(self,name)
  126. self._btrs[name]:Disconnect()
  127. end,
  128. },"RunService")
  129. }
  130. rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
  131. g.service = g.GetService
  132. FakeService(g,game)
  133. --Changing owner to fake player object to support owner:GetMouse()
  134. game,owner = g,g.Players.LocalPlayer
  135. end
  136.  
  137. plr = owner
  138. char = plr.Character
  139. root = char.HumanoidRootPart
  140. attack = false
  141. tors = char.Torso
  142. hum = char.Humanoid
  143. debby = game:GetService("Debris")
  144.  
  145. function swait(num)
  146. if num == 0 or num == nil then
  147. game:service("RunService").Stepped:wait(0)
  148. else
  149. for i = 0, num do
  150. game:service("RunService").Stepped:wait(0)
  151. end
  152. end
  153. end
  154.  
  155. function rayCast(Position, Direction, Range, Ignore)
  156. return game:service("Workspace"):FindPartOnRay(Ray.new(Position, Direction.unit * (Range or 999.999)), Ignore)
  157. end
  158.  
  159. local RbxUtility = LoadLibrary("RbxUtility")
  160. local Create = RbxUtility.Create
  161.  
  162. function BodyVel(part,faws)
  163. local bodyvel = Instance.new("BodyVelocity",part)
  164. local pep = 10000000
  165. bodyvel.P = pep
  166. bodyvel.MaxForce = Vector3.new(pep,pep,pep)
  167. bodyvel.Velocity = faws
  168. debby:AddItem(bodyvel,.2)
  169. end
  170.  
  171. CFuncs = {
  172. Part = {
  173. Create = function(Parent, Material, Reflectance, Transparency, BColor, Name, Size)
  174. local Part = Create("Part")({
  175. Parent = Parent,
  176. Reflectance = Reflectance,
  177. Transparency = Transparency,
  178. CanCollide = false,
  179. Locked = true,
  180. BrickColor = BrickColor.new(tostring(BColor)),
  181. Name = Name,
  182. Size = Size,
  183. Material = Material
  184. })
  185. RemoveOutlines(Part)
  186. return Part
  187. end
  188. },
  189. Mesh = {
  190. Create = function(Mesh, Part, MeshType, MeshId, OffSet, Scale)
  191. local Msh = Create(Mesh)({
  192. Parent = Part,
  193. Offset = OffSet,
  194. Scale = Scale
  195. })
  196. if Mesh == "SpecialMesh" then
  197. Msh.MeshType = MeshType
  198. Msh.MeshId = MeshId
  199. end
  200. return Msh
  201. end
  202. },
  203. Mesh = {
  204. Create = function(Mesh, Part, MeshType, MeshId, OffSet, Scale)
  205. local Msh = Create(Mesh)({
  206. Parent = Part,
  207. Offset = OffSet,
  208. Scale = Scale
  209. })
  210. if Mesh == "SpecialMesh" then
  211. Msh.MeshType = MeshType
  212. Msh.MeshId = MeshId
  213. end
  214. return Msh
  215. end
  216. },
  217. Weld = {
  218. Create = function(Parent, Part0, Part1, C0, C1)
  219. local Weld = Create("Weld")({
  220. Parent = Parent,
  221. Part0 = Part0,
  222. Part1 = Part1,
  223. C0 = C0,
  224. C1 = C1
  225. })
  226. return Weld
  227. end
  228. },
  229. Sound = {
  230. Create = function(id, par, vol, pit)
  231. coroutine.resume(coroutine.create(function()
  232. local S = Create("Sound")({
  233. Volume = vol,
  234. Pitch = pit or 1,
  235. SoundId = id,
  236. Parent = par or workspace
  237. })
  238. wait()
  239. S:play()
  240. game:GetService("Debris"):AddItem(S, 6)
  241. end))
  242. end
  243. },
  244. ParticleEmitter = {
  245. Create = function(Parent, Color1, Color2, LightEmission, Size, Texture, Transparency, ZOffset, Accel, Drag, LockedToPart, VelocityInheritance, EmissionDirection, Enabled, LifeTime, Rate, Rotation, RotSpeed, Speed, VelocitySpread)
  246. local fp = Create("ParticleEmitter")({
  247. Parent = Parent,
  248. Color = ColorSequence.new(Color1, Color2),
  249. LightEmission = LightEmission,
  250. Size = Size,
  251. Texture = Texture,
  252. Transparency = Transparency,
  253. ZOffset = ZOffset,
  254. Acceleration = Accel,
  255. Drag = Drag,
  256. LockedToPart = LockedToPart,
  257. VelocityInheritance = VelocityInheritance,
  258. EmissionDirection = EmissionDirection,
  259. Enabled = Enabled,
  260. Lifetime = LifeTime,
  261. Rate = Rate,
  262. Rotation = Rotation,
  263. RotSpeed = RotSpeed,
  264. Speed = Speed,
  265. VelocitySpread = VelocitySpread
  266. })
  267. return fp
  268. end
  269. }
  270. }
  271.  
  272.  
  273. function RemoveOutlines(part)
  274. part.TopSurface, part.BottomSurface, part.LeftSurface, part.RightSurface, part.FrontSurface, part.BackSurface = 10, 10, 10, 10, 10, 10
  275. end
  276. function CreatePart(FormFactor, Parent, Material, Reflectance, Transparency, BColor, Name, Size)
  277. local Part = Create("Part")({
  278. formFactor = FormFactor,
  279. Parent = Parent,
  280. Reflectance = Reflectance,
  281. Transparency = Transparency,
  282. CanCollide = false,
  283. Locked = true,
  284. BrickColor = BrickColor.new(tostring(BColor)),
  285. Name = Name,
  286. Size = Size,
  287. Material = Material
  288. })
  289. RemoveOutlines(Part)
  290. return Part
  291. end
  292. function CreateMesh(Mesh, Part, MeshType, MeshId, OffSet, Scale)
  293. local Msh = Create(Mesh)({
  294. Parent = Part,
  295. Offset = OffSet,
  296. Scale = Scale
  297. })
  298. if Mesh == "SpecialMesh" then
  299. Msh.MeshType = MeshType
  300. Msh.MeshId = MeshId
  301. end
  302. return Msh
  303. end
  304. function CreateWeld(Parent, Part0, Part1, C0, C1)
  305. local Weld = Create("Weld")({
  306. Parent = Parent,
  307. Part0 = Part0,
  308. Part1 = Part1,
  309. C0 = C0,
  310. C1 = C1
  311. })
  312. return Weld
  313. end
  314.  
  315. EffectModel = Instance.new("Model", char)
  316. Effects = {
  317. Block = {
  318. Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay, Type)
  319. local prt = CFuncs.Part.Create(EffectModel, "SmoothPlastic", 0, 0, brickcolor, "Effect", Vector3.new())
  320. prt.Anchored = true
  321. prt.CFrame = cframe
  322. local msh = CFuncs.Mesh.Create("BlockMesh", prt, "", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
  323. game:GetService("Debris"):AddItem(prt, 10)
  324. if Type == 1 or Type == nil then
  325. table.insert(Effects, {
  326. prt,
  327. "Block1",
  328. delay,
  329. x3,
  330. y3,
  331. z3,
  332. msh
  333. })
  334. elseif Type == 2 then
  335. table.insert(Effects, {
  336. prt,
  337. "Block2",
  338. delay,
  339. x3,
  340. y3,
  341. z3,
  342. msh
  343. })
  344. else
  345. table.insert(Effects, {
  346. prt,
  347. "Block3",
  348. delay,
  349. x3,
  350. y3,
  351. z3,
  352. msh
  353. })
  354. end
  355. end
  356. },
  357. Sphere = {
  358. Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
  359. local prt = CFuncs.Part.Create(EffectModel, "Neon", 0, 0, brickcolor, "Effect", Vector3.new())
  360. prt.Anchored = true
  361. prt.CFrame = cframe
  362. local msh = CFuncs.Mesh.Create("SpecialMesh", prt, "Sphere", "", Vector3.new(0,0,0), Vector3.new(x1, y1, z1))
  363. game:GetService("Debris"):AddItem(prt, 10)
  364. table.insert(Effects, {
  365. prt,
  366. "Cylinder",
  367. delay,
  368. x3,
  369. y3,
  370. z3,
  371. msh
  372. })
  373. end
  374. },
  375. Cylinder = {
  376. Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
  377. local prt = CFuncs.Part.Create(EffectModel, "SmoothPlastic", 0, 0, brickcolor, "Effect", Vector3.new())
  378. prt.Anchored = true
  379. prt.CFrame = cframe
  380. local msh = CFuncs.Mesh.Create("CylinderMesh", prt, "", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
  381. game:GetService("Debris"):AddItem(prt, 10)
  382. table.insert(Effects, {
  383. prt,
  384. "Cylinder",
  385. delay,
  386. x3,
  387. y3,
  388. z3,
  389. msh
  390. })
  391. end
  392. },
  393. Wave = {
  394. Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
  395. local prt = CFuncs.Part.Create(EffectModel, "Neon", 0, 0, brickcolor, "Effect", Vector3.new())
  396. prt.Anchored = true
  397. prt.CFrame = cframe
  398. local msh = CFuncs.Mesh.Create("SpecialMesh", prt, "FileMesh", "rbxassetid://20329976", Vector3.new(0, 0, 0), Vector3.new(x1 / 60, y1 / 60, z1 / 60))
  399. game:GetService("Debris"):AddItem(prt, 10)
  400. table.insert(Effects, {
  401. prt,
  402. "Cylinder",
  403. delay,
  404. x3 / 60,
  405. y3 / 60,
  406. z3 / 60,
  407. msh
  408. })
  409. end
  410. },
  411. Ring = {
  412. Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
  413. local prt = CFuncs.Part.Create(EffectModel, "SmoothPlastic", 0, 0, brickcolor, "Effect", Vector3.new())
  414. prt.Anchored = true
  415. prt.CFrame = cframe
  416. local msh = CFuncs.Mesh.Create("SpecialMesh", prt, "FileMesh", "rbxassetid://3270017", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
  417. game:GetService("Debris"):AddItem(prt, 10)
  418. table.insert(Effects, {
  419. prt,
  420. "Cylinder",
  421. delay,
  422. x3,
  423. y3,
  424. z3,
  425. msh
  426. })
  427. end
  428. },
  429. Break = {
  430. Create = function(brickcolor, cframe, x1, y1, z1)
  431. local prt = CFuncs.Part.Create(EffectModel, "Neon", 0, 0, brickcolor, "Effect", Vector3.new(0.5, 0.5, 0.5))
  432. prt.Anchored = true
  433. prt.CFrame = cframe * CFrame.fromEulerAnglesXYZ(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50))
  434. local msh = CFuncs.Mesh.Create("SpecialMesh", prt, "Sphere", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
  435. local num = math.random(10, 50) / 1000
  436. game:GetService("Debris"):AddItem(prt, 10)
  437. table.insert(Effects, {
  438. prt,
  439. "Shatter",
  440. num,
  441. prt.CFrame,
  442. math.random() - math.random(),
  443. 0,
  444. math.random(50, 100) / 100
  445. })
  446. end
  447. },
  448. Spiral = {
  449. Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
  450. local prt = CFuncs.Part.Create(EffectModel, "SmoothPlastic", 0, 0, brickcolor, "Effect", Vector3.new())
  451. prt.Anchored = true
  452. prt.CFrame = cframe
  453. local msh = CFuncs.Mesh.Create("SpecialMesh", prt, "FileMesh", "rbxassetid://1051557", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
  454. game:GetService("Debris"):AddItem(prt, 10)
  455. table.insert(Effects, {
  456. prt,
  457. "Cylinder",
  458. delay,
  459. x3,
  460. y3,
  461. z3,
  462. msh
  463. })
  464. end
  465. },
  466. Push = {
  467. Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
  468. local prt = CFuncs.Part.Create(EffectModel, "SmoothPlastic", 0, 0, brickcolor, "Effect", Vector3.new())
  469. prt.Anchored = true
  470. prt.CFrame = cframe
  471. local msh = CFuncs.Mesh.Create("SpecialMesh", prt, "FileMesh", "rbxassetid://437347603", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
  472. game:GetService("Debris"):AddItem(prt, 10)
  473. table.insert(Effects, {
  474. prt,
  475. "Cylinder",
  476. delay,
  477. x3,
  478. y3,
  479. z3,
  480. msh
  481. })
  482. end
  483. }
  484. }
  485.  
  486. ball = Instance.new("Part",char)
  487. ball.Size = Vector3.new(4, 4, 4)
  488. ball.Shape = "Ball"
  489. ball.BrickColor = tors.BrickColor
  490. ball.Position = tors.Position
  491. ball.CanCollide = false
  492. ball.Transparency = 1
  493. ball.Material = "SmoothPlastic"
  494. ball.Name = "Ball"
  495. weld = Instance.new("Weld",ball)
  496. weld.Part0 = ball
  497. weld.Part1 = root
  498.  
  499. local hitter = ball.Touched:connect(function(hit)
  500. if ball.Transparency ~= 1 then
  501. if hit.Parent ~= char and hit.Parent.Name ~= "Workspace" then
  502. hit.Parent:BreakJoints()
  503. local boom = Instance.new("Sound",char) boom.SoundId = "rbxassetid://467680075" boom.Volume = 10 boom:Play()
  504. end
  505. end
  506. end)
  507.  
  508.  
  509. function NewSound(parent,id,volume)
  510. local Sound = Instance.new("Sound",parent)
  511. Sound.SoundId = "rbxassetid://" ..id
  512. Sound.Volume = volume
  513. Sound:Play()
  514. return Sound
  515. end
  516.  
  517. local spin = NewSound(root,163619849,10)
  518. spin.Looped = true
  519. spin.Pitch = 1
  520. spin.Playing = false
  521.  
  522. mouse = plr:GetMouse()
  523. function dash()
  524. attack = true
  525. spin:Play()
  526. spin.Pitch = spin.Pitch + 0.1
  527. ball.BrickColor = tors.BrickColor
  528. ball.Transparency = 0
  529. for _,v in pairs (char:children()) do
  530. if v:IsA("Part") and v.Name ~= "HumanoidRootPart" and v.Name ~= "Ball" then
  531. v.Transparency = 1
  532. if v.Name == "Head" then
  533. v.face.Transparency = 1
  534. end
  535. end
  536. if v:IsA("Accessory") or v:IsA("Hat") then
  537. v:FindFirstChildOfClass("Part").Transparency = 1
  538. end
  539. end
  540. root.Anchored = true
  541. end
  542.  
  543. mouse.KeyDown:connect(function(key)
  544. key=key:lower()
  545. if key == 'z' then
  546. dash()
  547. end
  548. end)
  549.  
  550. mouse.KeyUp:connect(function(key)
  551. key=key:lower()
  552. if key == 'z' then
  553. spin.Pitch = 1
  554. spin.Playing = false
  555. NewSound(root,500223047,10)
  556. root.Anchored = false
  557. BodyVel(root,root.CFrame.lookVector*500)
  558. wait(0.75)
  559. for _,v in pairs (char:children()) do
  560. if v:IsA("Part") and v.Name ~= "HumanoidRootPart" and v.Name ~= "Ball" then
  561. v.Transparency = 0
  562. if v.Name == "Head" then
  563. v.face.Transparency = 0
  564. end
  565. end
  566. if v:IsA("Accessory") or v:IsA("Hat") then
  567. v:FindFirstChildOfClass("Part").Transparency = 0
  568. end
  569. end
  570. attack = false
  571. end
  572. end)
  573.  
  574. local DEAD = false
  575. local HIT = false
  576. lost = 1053865439
  577. ringm = "rbxassetid://452074819"
  578.  
  579. char.Humanoid.Died:connect(function()
  580. DEAD = true
  581. end)
  582.  
  583. local h = char.Humanoid
  584. local hp = h.Health
  585.  
  586. rings = Instance.new("Model",script)
  587.  
  588. function HealthChanged()
  589. if h.Health < hp then
  590. if h.Health > 0 then
  591. local Owch = NewSound(root,lost,10)
  592. BodyVel(root,root.CFrame.lookVector * -15)
  593. BodyVel(root,Vector3.new(0, 25, 0))
  594. local rang = Instance.new("Part",rings)
  595. rang.Position = root.Position
  596. rang.Size = Vector3.new(0.25, 0.25, 0.25)
  597. rang.BrickColor = BrickColor.new("New Yeller")
  598. local mesho = Instance.new("SpecialMesh",rang)
  599. mesho.MeshId = ringm
  600. mesho.Scale = Vector3.new(0.05, 0.05, 0.05)
  601. local clone = rang:Clone()
  602. clone.Parent = rings
  603. local clone = rang:Clone()
  604. clone.Parent = rings
  605. local clone = rang:Clone()
  606. clone.Parent = rings
  607. local clone = rang:Clone()
  608. clone.Parent = rings
  609. local clone = rang:Clone()
  610. clone.Parent = rings
  611. local weld = Instance.new("Weld",owner.Character.Torso)
  612. weld.Part0 = owner.Character.Torso
  613. weld.Part1 = owner.Character.HumanoidRootPart
  614. weld.C0 = CFrame.Angles(-0.5, 0, 0)
  615. for _,v in pairs (rings:children()) do
  616. if v:IsA("Part") then
  617. v.Velocity = Vector3.new(math.random(-60,60),math.random(-60,60),math.random(-60,60))
  618. end
  619. end
  620. coroutine.resume(coroutine.create(function()
  621. wait(0.5)
  622. weld:Destroy()
  623. end))
  624. coroutine.resume(coroutine.create(function()
  625. wait(10)
  626. rings:ClearAllChildren()
  627. end))
  628. end
  629. end
  630. hp = h.Health
  631. end
  632.  
  633. h.HealthChanged:Connect(HealthChanged)
  634.  
  635. local equipped = false
  636. local idle = 0
  637. local change = 1
  638. local val = 0
  639. local toim = 0
  640. local idleanim = 0.4
  641. local sine = 0
  642. while true do
  643. swait()
  644. if h.Jump == true then
  645. local spin = NewSound(root,130782425,10)
  646. end
  647. sine = sine + change
  648. local torvel = (root.Velocity * Vector3.new(1, 0, 1)).magnitude
  649. local velderp = root.Velocity.y
  650. hitfloor, posfloor = rayCast(root.Position, CFrame.new(root.Position, root.Position - Vector3.new(0, 1, 0)).lookVector, 4, char)
  651. if equipped == true or equipped == false then
  652. if attack == false then
  653. idle = idle + 1
  654. else
  655. idle = 0
  656. end
  657. if 1 < root.Velocity.y and hitfloor == nil then
  658. Anim = "Jump"
  659. if attack == false then
  660. ball.BrickColor = tors.BrickColor
  661. ball.Transparency = 0
  662. for _,v in pairs (char:children()) do
  663. if v:IsA("Part") and v.Name ~= "HumanoidRootPart" and v.Name ~= "Ball" then
  664. v.Transparency = 1
  665. if v.Name == "Head" then
  666. v.face.Transparency = 1
  667. end
  668. end
  669. if v:IsA("Accessory") or v:IsA("Hat") then
  670. v:FindFirstChildOfClass("Part").Transparency = 1
  671. end
  672. end
  673. end
  674. elseif -1 > root.Velocity.y and hitfloor == nil then
  675. Anim = "Fall"
  676. if attack == false then
  677. ball.BrickColor = tors.BrickColor
  678. ball.Transparency = 0
  679. for _,v in pairs (char:children()) do
  680. if v:IsA("Part") and v.Name ~= "HumanoidRootPart" and v.Name ~= "Ball" then
  681. v.Transparency = 1
  682. if v.Name == "Head" then
  683. v.face.Transparency = 1
  684. end
  685. end
  686. if v:IsA("Accessory") or v:IsA("Hat") then
  687. v:FindFirstChildOfClass("Part").Transparency = 1
  688. end
  689. end
  690. end
  691. elseif torvel < 1 and hitfloor ~= nil then
  692. Anim = "Idle"
  693. change = .5
  694. if attack == false then
  695. hum.WalkSpeed = 16
  696. ball.BrickColor = tors.BrickColor
  697. ball.Transparency = 1
  698. for _,v in pairs (char:children()) do
  699. if v:IsA("Part") and v.Name ~= "HumanoidRootPart" and v.Name ~= "Ball" then
  700. v.Transparency = 0
  701. if v.Name == "Head" then
  702. v.face.Transparency = 0
  703. end
  704. end
  705. if v:IsA("Accessory") or v:IsA("Hat") then
  706. v:FindFirstChildOfClass("Part").Transparency = 0
  707. end
  708. end
  709. end
  710. elseif tors.Velocity.magnitude < 10000000000000 and hitfloor ~= nil then
  711. Anim = "Walk"
  712. change = 1
  713. if attack == false then
  714. hum.WalkSpeed = hum.WalkSpeed + 0.5
  715. ball.BrickColor = tors.BrickColor
  716. ball.Transparency = 1
  717. for _,v in pairs (char:children()) do
  718. if v:IsA("Part") and v.Name ~= "HumanoidRootPart" and v.Name ~= "Ball" then
  719. v.Transparency = 0
  720. if v.Name == "Head" then
  721. v.face.Transparency = 0
  722. end
  723. end
  724. if v:IsA("Accessory") or v:IsA("Hat") then
  725. v:FindFirstChildOfClass("Part").Transparency = 0
  726. end
  727. end
  728. end
  729. end
  730. end
  731. if 0 < #Effects then
  732. for e = 1, #Effects do
  733. if Effects[e] ~= nil then
  734. local Thing = Effects[e]
  735. if Thing ~= nil then
  736. local Part = Thing[1]
  737. local Mode = Thing[2]
  738. local Delay = Thing[3]
  739. local IncX = Thing[4]
  740. local IncY = Thing[5]
  741. local IncZ = Thing[6]
  742. if 1 >= Thing[1].Transparency then
  743. if Thing[2] == "Block1" then
  744. Thing[1].CFrame = Thing[1].CFrame * CFrame.fromEulerAnglesXYZ(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50))
  745. local Mesh = Thing[1].Mesh
  746. Mesh.Scale = Mesh.Scale + Vector3.new(Thing[4], Thing[5], Thing[6])
  747. Thing[1].Transparency = Thing[1].Transparency + Thing[3]
  748. elseif Thing[2] == "Block2" then
  749. Thing[1].CFrame = Thing[1].CFrame + Vector3.new(0, 0, 0)
  750. local Mesh = Thing[7]
  751. Mesh.Scale = Mesh.Scale + Vector3.new(Thing[4], Thing[5], Thing[6])
  752. Thing[1].Transparency = Thing[1].Transparency + Thing[3]
  753. elseif Thing[2] == "Block3" then
  754. Thing[1].CFrame = Thing[1].CFrame * CFrame.fromEulerAnglesXYZ(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50)) + Vector3.new(0, 0.15, 0)
  755. local Mesh = Thing[7]
  756. Mesh.Scale = Mesh.Scale + Vector3.new(Thing[4], Thing[5], Thing[6])
  757. Thing[1].Transparency = Thing[1].Transparency + Thing[3]
  758. elseif Thing[2] == "Cylinder" then
  759. local Mesh = Thing[1].Mesh
  760. Mesh.Scale = Mesh.Scale + Vector3.new(Thing[4], Thing[5], Thing[6])
  761. Thing[1].Transparency = Thing[1].Transparency + Thing[3]
  762. elseif Thing[2] == "Blood" then
  763. local Mesh = Thing[7]
  764. Thing[1].CFrame = Thing[1].CFrame * Vector3.new(0, 0.5, 0)
  765. Mesh.Scale = Mesh.Scale + Vector3.new(Thing[4], Thing[5], Thing[6])
  766. Thing[1].Transparency = Thing[1].Transparency + Thing[3]
  767. elseif Thing[2] == "Elec" then
  768. local Mesh = Thing[1].Mesh
  769. Mesh.Scale = Mesh.Scale + Vector3.new(Thing[7], Thing[8], Thing[9])
  770. Thing[1].Transparency = Thing[1].Transparency + Thing[3]
  771. elseif Thing[2] == "Disappear" then
  772. Thing[1].Transparency = Thing[1].Transparency + Thing[3]
  773. elseif Thing[2] == "Shatter" then
  774. Thing[1].Transparency = Thing[1].Transparency + Thing[3]
  775. Thing[4] = Thing[4] * CFrame.new(0, Thing[7], 0)
  776. Thing[1].CFrame = Thing[4] * CFrame.fromEulerAnglesXYZ(Thing[6], 0, 0)
  777. Thing[6] = Thing[6] + Thing[5]
  778. end
  779. else
  780. Part.Parent = nil
  781. table.remove(Effects, e)
  782. end
  783. end
  784. end
  785. end
  786. end
  787. end
  788. -------------------------------------------------------
  789. --End Animations And Script--
  790. -------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement