ZeroReinard

ParKoUR

Dec 17th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.39 KB | None | 0 0
  1. --By Rufus14
  2. --owner = game:GetService("Players"):GetPlayerFromCharacter(script.Parent)
  3. character = owner.Character
  4. NLS([[
  5. --By Rufus14
  6. owner = game:GetService("Players").LocalPlayer
  7. local ownerhead = owner.Character:WaitForChild("Head")
  8. parkietremote = owner.Character:WaitForChild("parkietremote")
  9. mouse = owner:GetMouse()
  10. local part = Instance.new("Part", owner.Character.Head)
  11. part.Size = Vector3.new(0.1,0.1,0.1)
  12. part.Transparency = 1
  13. part.CanCollide = false
  14. part.Name = "camera"
  15. part:BreakJoints()
  16. local weld = Instance.new("Weld", part)
  17. weld.Part0 = owner.Character.Head
  18. weld.Part1 = part
  19. weld.C0 = CFrame.new(0,0,-1)
  20. cananimate = true
  21. walkpressed = 0
  22. humanoid = owner.Character:findFirstChildOfClass("Humanoid")
  23. rootpart = owner.Character.HumanoidRootPart
  24. runservice = game:GetService("RunService")
  25. --
  26. canmovecamera = true
  27. wrunning = false
  28. wrunningl = false
  29. owner.Character.ChildAdded:connect(function(whatadded)
  30. if whatadded.Name == "slide" then
  31. canmovecamera = false
  32. for i = 1,60 do
  33. workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(math.sin(tick()*45)/(i/6)),0,0)
  34. runservice.RenderStepped:wait()
  35. end
  36. elseif whatadded.Name == "vwallrun" then
  37. canmovecamera = false
  38. for i = 1,20 do
  39. workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(2),0,0)
  40. runservice.RenderStepped:wait()
  41. end
  42. elseif whatadded.Name == "hwallrunright" then
  43. wrunning = true
  44. canmovecamera = false
  45. coroutine.wrap(function()
  46. while wrunning and runservice.RenderStepped:wait() do
  47. workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame:lerp(workspace.CurrentCamera.CFrame * CFrame.fromEulerAnglesXYZ(0,0,math.rad(30)),0.2)
  48. end
  49. end)()
  50. elseif whatadded.Name == "hwallrunleft" then
  51. wrunningl = true
  52. canmovecamera = false
  53. coroutine.wrap(function()
  54. while wrunningl and runservice.RenderStepped:wait() do
  55. workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame:lerp(workspace.CurrentCamera.CFrame * CFrame.fromEulerAnglesXYZ(0,0,math.rad(-30)),0.2)
  56. end
  57. end)()
  58. elseif whatadded.Name == "FALLING" then
  59. local screengui = Instance.new("ScreenGui", owner:findFirstChildOfClass("PlayerGui"))
  60. screengui.ResetOnSpawn = true
  61. screengui.Name = "ohgodohfuck"
  62. humanoid.Died:connect(function()
  63. screengui:destroy()
  64. end)
  65. local frame = Instance.new("ImageLabel", screengui)
  66. frame.BackgroundTransparency = 1
  67. frame.ImageTransparency = 1
  68. frame.ImageColor3 = Color3.fromRGB(0,0,0)
  69. frame.Image = "http://www.roblox.com/asset/?id=22606915"
  70. frame.Size = UDim2.new(1,0,1,0)
  71. for i = 1,20 do
  72. frame.ImageTransparency = frame.ImageTransparency - 0.05
  73. runservice.Stepped:wait()
  74. end
  75. coroutine.wrap(function()
  76. while rootpart.Velocity.y < -10 do runservice.RenderStepped:wait() end
  77. owner.Character:BreakJoints()
  78. end)()
  79. end
  80. end)
  81. owner.Character.ChildRemoved:connect(function(whatremoved)
  82. if whatremoved.Name == "slide" then
  83. canmovecamera = true
  84. elseif whatremoved.Name == "vwallrun" then
  85. for i = 1,20 do
  86. workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(-2),0,0)
  87. runservice.RenderStepped:wait()
  88. end
  89. canmovecamera = true
  90. elseif whatremoved.Name == "hwallrunright" then
  91. canmovecamera = true
  92. wrunning = false
  93. elseif whatremoved.Name == "hwallrunleft" then
  94. canmovecamera = true
  95. wrunningl = false
  96. end
  97. end)
  98. --
  99. mouse.KeyDown:connect(function(key)
  100. key = key:lower()
  101. if key == "w" or key == "a" or key == "s" or key == "d" then
  102. walkpressed = walkpressed + 1
  103. end
  104. if key == "r" then
  105. parkietremote:FireServer(rootpart.CFrame, "triggerroll")
  106. end
  107. if key == "e" then
  108. parkietremote:FireServer(rootpart.CFrame, "slide")
  109. end
  110. end)
  111. mouse.KeyUp:connect(function(key)
  112. key = key:lower()
  113. if key == "w" or key == "a" or key == "s" or key == "d" then
  114. walkpressed = walkpressed - 1
  115. end
  116. if key == "r" then
  117. parkietremote:FireServer(rootpart.CFrame, "triggerroll")
  118. end
  119. end)
  120. --
  121. humanoid.Died:connect(function()
  122. local correction = Instance.new("ColorCorrectionEffect", workspace.CurrentCamera)
  123. local deathsound = Instance.new("Sound", workspace)
  124. deathsound.SoundId = "rbxassetid://1038809455"
  125. deathsound.Volume = 10
  126. deathsound:Play()
  127. game.Debris:AddItem(deathsound, deathsound.TimeLength)
  128. game.Debris:AddItem(correction, game:GetService("Players").RespawnTime)
  129. for i = 1,5 do
  130. correction.Brightness = correction.Brightness + 0.2
  131. runservice.RenderStepped:wait()
  132. end
  133. while runservice.RenderStepped:wait() do
  134. workspace.CurrentCamera.CFrame = CFrame.new(0,9999999,0)
  135. end
  136. end)
  137. --
  138. while game:GetService("RunService").RenderStepped:wait() do
  139. ----
  140. local vwallray = Ray.new(rootpart.CFrame.p, rootpart.CFrame.lookVector * 1.5)
  141. local vwallhit, vwallpos = workspace:FindPartOnRayWithIgnoreList(vwallray, {owner.Character})
  142. if vwallhit and humanoid.Jump and rootpart.Velocity.y > -10 then
  143. if not vwallhit.Parent:findFirstChildOfClass("Humanoid") then
  144. parkietremote:FireServer(rootpart.CFrame, "vwallrun")
  145. end
  146. end
  147. ---
  148. local hwallray = Ray.new(rootpart.CFrame.p, rootpart.CFrame.rightVector * 3.5)
  149. local hwallhit, hwallpos, surface = workspace:FindPartOnRayWithIgnoreList(hwallray, {owner.Character})
  150. if hwallhit and humanoid.Jump and rootpart.Velocity.y > -10 then
  151. if not hwallhit.Parent:findFirstChildOfClass("Humanoid") then
  152. parkietremote:FireServer(rootpart.CFrame, "hwallrunright", hwallhit, hwallpos, surface)
  153. end
  154. end
  155. --
  156. local hwallrayl = Ray.new(rootpart.CFrame.p, rootpart.CFrame.rightVector * -3.5)
  157. local hwallhitl, hwallposl, surfacel = workspace:FindPartOnRayWithIgnoreList(hwallrayl, {owner.Character})
  158. if hwallhitl and humanoid.Jump and rootpart.Velocity.y > -10 then
  159. if not hwallhitl.Parent:findFirstChildOfClass("Humanoid") then
  160. parkietremote:FireServer(rootpart.CFrame, "hwallrunleft", hwallhitl, hwallposl, surfacel)
  161. end
  162. end
  163. --
  164. ----
  165. if walkpressed > 0 and humanoid.WalkSpeed < 23 and not owner.Character:findFirstChild("ouchfell") then
  166. humanoid.WalkSpeed = humanoid.WalkSpeed + 1.4
  167. elseif walkpressed == 0 and humanoid.WalkSpeed > 0 and not owner.Character:findFirstChild("ouchfell") then
  168. humanoid.WalkSpeed = humanoid.WalkSpeed - 1.4
  169. end
  170. if (workspace.CurrentCamera.CFrame.p - part.Position).magnitude <= 1.7 then
  171. if canmovecamera and not owner.Character:findFirstChild("ouchfell") and not owner.Character:findFirstChild("rollin") then
  172. game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.Position,Vector3.new(mouse.Hit.p.x,game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.Position.y,mouse.Hit.p.z))
  173. end
  174. if owner.Character:findFirstChild("ouchfell") then
  175. workspace.CurrentCamera.CFrame = owner.Character.Head.CFrame * CFrame.new(0,0,-0.4)
  176. end
  177. if owner.Character:findFirstChild("rollin") then
  178. workspace.CurrentCamera.CFrame = owner.Character.Head.CFrame * CFrame.new(0,0,-0.2)
  179. end
  180. if owner.Character:findFirstChild("FALLING") then
  181. canmovecamera = false
  182. workspace.CurrentCamera.CFrame = owner.Character.Head.CFrame * CFrame.new(0,0,-0.4) * CFrame.fromEulerAnglesXYZ(math.rad(math.sin(tick()*45))*6,0,0)
  183. end
  184. workspace.CurrentCamera.FieldOfView = 120
  185. for i,v in pairs(owner.Character:GetChildren()) do
  186. if v.ClassName == "Part" or v.ClassName == "MeshPart" and v.Name ~= "Head" then
  187. v.LocalTransparencyModifier = 0
  188. end
  189. if v.ClassName == "Accessory" then
  190. v.Handle.Transparency = 1
  191. end
  192. end
  193. if owner.Character.Head:findFirstChildOfClass("Decal") then
  194. owner.Character.Head:findFirstChildOfClass("Decal").Transparency = 1
  195. end
  196. owner.Character.Head.Transparency = 1
  197. workspace.CurrentCamera.CameraSubject = part
  198. else
  199. for i,v in pairs(owner.Character:GetChildren()) do
  200. if v.ClassName == "Accessory" then
  201. v.Handle.Transparency = 0
  202. end
  203. end
  204. workspace.CurrentCamera.FieldOfView = 70
  205. owner.Character.Head.Transparency = 0
  206. if owner.Character.Head:findFirstChildOfClass("Decal") then
  207. owner.Character.Head:findFirstChildOfClass("Decal").Transparency = 0
  208. end
  209. workspace.CurrentCamera.CameraSubject = owner.Character
  210. end
  211. end
  212. ]], character)
  213. local ownerhead = character:WaitForChild("Head")
  214. mouse = owner:GetMouse()
  215. anim = "idle"
  216. cananimate = true
  217. humanoid = character:findFirstChildOfClass("Humanoid")
  218. rootpart = character.HumanoidRootPart
  219. runservice = game:GetService("RunService")
  220. local rightarm = Instance.new("Weld", owner.Character.Torso)
  221. rightarm.Part0 = owner.Character.Torso
  222. rightarm.Part1 = owner.Character["Right Arm"]
  223. rightarm.C0 = CFrame.new(1.5,0,0)
  224. rightarm.Name = "RightArmWeld"
  225. local rightleg = Instance.new("Weld", owner.Character.Torso)
  226. rightleg.Part0 = owner.Character.Torso
  227. rightleg.Part1 = owner.Character["Right Leg"]
  228. rightleg.C0 = CFrame.new(0.5,-2,0)
  229. rightleg.Name = "RightLegWeld"
  230. local leftarm = Instance.new("Weld", owner.Character.Torso)
  231. leftarm.Part0 = owner.Character.Torso
  232. leftarm.Part1 = owner.Character["Left Arm"]
  233. leftarm.C0 = CFrame.new(-1.5,0,0)
  234. leftarm.Name = "LeftArmWeld"
  235. local leftleg = Instance.new("Weld", owner.Character.Torso)
  236. leftleg.Part0 = owner.Character.Torso
  237. leftleg.Part1 = owner.Character["Left Leg"]
  238. leftleg.C0 = CFrame.new(-0.5,-2,0)
  239. leftleg.Name = "LeftLegWeld"
  240. local head = Instance.new("Weld", owner.Character.Torso)
  241. head.Part0 = owner.Character.Torso
  242. head.Part1 = owner.Character.Head
  243. head.C0 = CFrame.new(0,1.5,0)
  244. head.Name = "HeadWeld"
  245. local humanoidrootpart = Instance.new("Weld", owner.Character.HumanoidRootPart)
  246. humanoidrootpart.Part0 = owner.Character.HumanoidRootPart
  247. humanoidrootpart.Part1 = owner.Character.Torso
  248. humanoidrootpart.Name = "HumanoidRootPartWeld"
  249. local music = Instance.new("Sound", owner.Character.Head)
  250. music.Looped = true
  251. local musicrandom = math.random(1,4)
  252. if musicrandom == 1 then
  253. music.SoundId = "rbxassetid://4502246491"
  254. music.Volume = 2
  255. elseif musicrandom == 2 then
  256. music.SoundId = "rbxassetid://1842306658"
  257. music.Volume = 2
  258. elseif musicrandom == 3 then
  259. music.SoundId = "rbxassetid://4433374633"
  260. music.Volume = 2
  261. elseif musicrandom == 4 then
  262. music.SoundId = "rbxassetid://3863023710"
  263. music.Volume = 2
  264. end
  265. music:Play()
  266. local runsound = Instance.new("Sound", owner.Character.Head)
  267. runsound.SoundId = "rbxassetid://3084278209"
  268. runsound.Looped = true
  269. runsound:Play()
  270. runsound.PlaybackSpeed = 1.4
  271. local bodyhitsound = Instance.new("Sound", owner.Character.Head)
  272. bodyhitsound.SoundId = "rbxassetid://2681124848"
  273. bodyhitsound.Volume = 5
  274. local fallingsound = Instance.new("Sound", owner.Character.Head)
  275. fallingsound.SoundId = "rbxassetid://866649671"
  276. fallingsound.Volume = 0
  277. fallingsound.Looped = true
  278. fallingsound:Play()
  279. local parkietremote = Instance.new("RemoteEvent", character)
  280. parkietremote.Name = "parkietremote"
  281. cando = true
  282. roll = false
  283. fallingtodeath = false
  284. parkietremote.OnServerEvent:connect(function(plr, rootpos, what, rayehit, rayepos, rayesurface)
  285. if plr == owner and not fallingtodeath and cando then
  286. character.HumanoidRootPart.CanCollide = false
  287. if what == "slide" then
  288. cananimate = false
  289. cando = false
  290. local action = Instance.new("BoolValue", character)
  291. action.Name = "slide"
  292. local velo = Instance.new("BodyVelocity", rootpart)
  293. velo.MaxForce = Vector3.new(math.huge,0,math.huge)
  294. velo.Velocity = rootpart.CFrame.lookVector*22
  295. runsound.Volume = 0
  296. for i = 0,1 , 0.04 do
  297. rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.70441437, 0.561628342, 9.53674316e-07, 0.642787516, -0.766044259, 1.49011612e-08, 0.766044319, 0.642787576, 0, 1.17273338e-08, -1.27691155e-08, 0.99999994),i)
  298. leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.54449558, -0.470175743, -0.242582321, 0.983905256, -0.168530971, 0.0593911819, 0.178687513, 0.926305115, -0.331706733, 0.000888578361, 0.336980522, 0.941511095),i)
  299. leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.500000954, -1.64282608, -0.0428800583, 0.999999821, -1.0857935e-08, 1.23050938e-08, 0, 0.939692557, 0.342019677, 1.49011612e-08, -0.342019677, 0.939692557),i)
  300. rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5, -2, 0, 0.999999821, 0, 1.49011612e-08, 0, 0.99999994, 0, 1.49011612e-08, 0, 0.99999994),i)
  301. humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.new(-0.416755676, -2.3635385, 0, 0.98480767, 0, -0.173648164, -0.173648179, -4.37113883e-08, -0.98480773, -7.59040297e-09, 1, -4.30473115e-08),i)
  302. head.C0 = head.C0:lerp(CFrame.new(-9.53674316e-07, 1.15137196, -0.85847187, 0.999999821, -4.60215439e-08, -1.65799918e-07, 1.71363354e-07, 0.173648059, 0.98480767, 2.98023153e-08, -0.984807611, 0.173648059),i)
  303. runservice.Stepped:wait()
  304. end
  305. local funnysine = 0
  306. for i = 1,60 do
  307. local ray = Ray.new(character.Torso.Position, character.Torso.CFrame.upVector*-5.5)
  308. local hit, positionn = workspace:FindPartOnRayWithIgnoreList(ray, {character})
  309. if hit then
  310. break
  311. end
  312. velo.Velocity = velo.Velocity/1.01
  313. runservice.Stepped:wait()
  314. end
  315. velo:destroy()
  316. action:destroy()
  317. cananimate = true
  318. cando = true
  319. elseif what == "vwallrun" then
  320. cananimate = false
  321. cando = false
  322. humanoid.AutoRotate = false
  323. local action = Instance.new("BoolValue", character)
  324. action.Name = "vwallrun"
  325. character.HumanoidRootPart.CFrame = rootpos
  326. local goupvel = Instance.new("BodyVelocity", rootpart)
  327. goupvel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  328. goupvel.Velocity = Vector3.new(0,20,0)
  329. local gotin = false
  330. for i = 1,70 do
  331. local headray = Ray.new(rootpart.CFrame.p, rootpart.CFrame.upVector * 3.5)
  332. local headrayhit, headraypos = workspace:FindPartOnRayWithIgnoreList(headray, {owner.Character})
  333. if headrayhit then
  334. gotin = false
  335. break
  336. end
  337. local headraywall = Ray.new(ownerhead.CFrame.p, ownerhead.CFrame.lookVector * 2)
  338. local headraywallhit, headraywallpos = workspace:FindPartOnRayWithIgnoreList(headraywall, {owner.Character})
  339. if not headraywallhit then
  340. gotin = true
  341. break
  342. end
  343. goupvel.Velocity = goupvel.Velocity/1.025
  344. humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.new(),0.3)
  345. head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.Angles(math.rad(30),0,0) * CFrame.new(0,0.5,0),0.3)
  346. leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.Angles(math.pi/2+math.sin(i/5),0,math.cos(i/5)/3) * CFrame.new(0,-0.5,0),0.3)
  347. rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.Angles(math.pi/2-math.sin(i/5),0,-math.cos(i/5)/3) * CFrame.new(0,-0.5,0),0.3)
  348. leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1-math.cos(i/5)/2,0) * CFrame.Angles(-math.sin(i/5),0,0) * CFrame.new(0,-1,0),0.3)
  349. rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1+math.cos(i/5)/2,0) * CFrame.Angles(math.sin(i/5),0,0) * CFrame.new(0,-1,0),0.3)
  350. runservice.Stepped:wait()
  351. end
  352. action:destroy()
  353. if gotin then
  354. rootpart.Anchored = true
  355. for i = 1,30 do
  356. rootpart.CFrame = rootpart.CFrame * CFrame.new(0,0.15,-math.sin(i/14)/9)
  357. humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.fromEulerAnglesXYZ(math.rad(-20),0,0),0.3)
  358. head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.Angles(math.rad(20),0,0) * CFrame.new(0,0.5,0),0.3)
  359. leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.Angles(math.rad(60)+math.cos(i/7)*1.5,0,0) * CFrame.new(0,-0.5,0),0.3)
  360. rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.Angles(math.rad(60)+math.cos(i/7)*1.5,0,0) * CFrame.new(0,-0.5,0),0.3)
  361. leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1,0) * CFrame.Angles(0,0,0) * CFrame.new(0,-1,0),0.3)
  362. rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-0.25+math.cos(i/7)/1.2,-0.5) * CFrame.Angles(0,0,0) * CFrame.new(0,-1,0),0.3)
  363. runservice.Stepped:wait()
  364. end
  365. end
  366. humanoid.AutoRotate = true
  367. rootpart.Anchored = false
  368. goupvel:destroy()
  369. cananimate = true
  370. cando = true
  371. elseif what == "hwallrunright" and anim == "jumprun" or anim == "fallrun" and rayepos ~= nil then
  372. cananimate = false
  373. cando = false
  374. humanoid.AutoRotate = false
  375. local action = Instance.new("BoolValue", character)
  376. action.Name = "hwallrunright"
  377. rootpart.CFrame = CFrame.new(rayepos, rayepos + rayesurface) * CFrame.fromEulerAnglesXYZ(0,-math.pi/2,0)
  378. rootpart.CFrame = rootpart.CFrame * CFrame.new(-1.8,0,0)
  379. if rootpart:findFirstChild("wallrunvel") then
  380. rootpart:findFirstChild("wallrunvel"):destroy()
  381. end
  382. local goupvel = Instance.new("BodyVelocity", rootpart)
  383. goupvel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  384. goupvel.Velocity = rootpart.CFrame.lookVector * 20
  385. goupvel.Name = "wallrunvel"
  386. runsound.PlaybackSpeed = 1.7
  387. runsound.Volume = 0.3
  388. local jumped = false
  389. local shouldcontinue = true
  390. local candothat = true
  391. for i = 1,20 do
  392. local rootrightray = Ray.new(rootpart.CFrame.p, rootpart.CFrame.rightVector * 2.5)
  393. local wallrighthit, rootrightraypos = workspace:FindPartOnRayWithIgnoreList(rootrightray, {owner.Character})
  394. if not wallrighthit then
  395. shouldcontinue = false
  396. break
  397. end
  398. local rootfrontray = Ray.new(rootpart.CFrame.p, rootpart.CFrame.lookVector * 4)
  399. local rootfrontrayhit, rootfrontraypos = workspace:FindPartOnRayWithIgnoreList(rootfrontray, {owner.Character})
  400. if rootfrontrayhit then
  401. shouldcontinue = false
  402. break
  403. end
  404. humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.fromEulerAnglesXYZ(0,0,math.rad(30)),0.3)
  405. head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.Angles(0,0,0) * CFrame.new(0,0.5,0),0.3)
  406. leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.Angles(-math.sin(tick()*14)*1.3,0,math.rad(-15)) * CFrame.new(0,-0.5,0),0.3)
  407. rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.Angles(0,0,math.pi/1.5) * CFrame.new(0,-0.5,0),0.3)
  408. leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1+math.cos(tick()*14)/2,-math.cos(tick()*14)/2) * CFrame.fromEulerAnglesXYZ(math.sin(tick()*14),0,0) * CFrame.new(0,-1,0),0.2)
  409. rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1-math.cos(tick()*14)/2,math.cos(tick()*14)/2) * CFrame.fromEulerAnglesXYZ(-math.sin(tick()*14),0,0) * CFrame.new(0,-1,0),0.2)
  410. runservice.Stepped:wait()
  411. end
  412. for i = 1,60 do
  413. if candothat then
  414. if not shouldcontinue then
  415. break
  416. end
  417. if humanoid.Jump then
  418. jumped = true
  419. break
  420. end
  421. local rootrightray = Ray.new(rootpart.CFrame.p, rootpart.CFrame.rightVector * 2.5)
  422. local wallrighthit, rootrightraypos = workspace:FindPartOnRayWithIgnoreList(rootrightray, {owner.Character})
  423. if not wallrighthit then
  424. break
  425. end
  426. local rootfrontray = Ray.new(rootpart.CFrame.p, rootpart.CFrame.lookVector * 4)
  427. local rootfrontrayhit, rootfrontraypos = workspace:FindPartOnRayWithIgnoreList(rootfrontray, {owner.Character})
  428. if rootfrontrayhit then
  429. break
  430. end
  431. humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.fromEulerAnglesXYZ(0,0,math.rad(30)),0.3)
  432. head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.Angles(0,0,0) * CFrame.new(0,0.5,0),0.3)
  433. leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.Angles(-math.sin(tick()*14)*1.3,0,math.rad(-15)) * CFrame.new(0,-0.5,0),0.3)
  434. rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.Angles(0,0,math.pi/1.5) * CFrame.new(0,-0.5,0),0.3)
  435. leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1+math.cos(tick()*14)/2,-math.cos(tick()*14)/2) * CFrame.fromEulerAnglesXYZ(math.sin(tick()*14),0,0) * CFrame.new(0,-1,0),0.2)
  436. rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1-math.cos(tick()*14)/2,math.cos(tick()*14)/2) * CFrame.fromEulerAnglesXYZ(-math.sin(tick()*14),0,0) * CFrame.new(0,-1,0),0.2)
  437. runservice.Stepped:wait()
  438. end
  439. end
  440. action:destroy()
  441. candothat = false
  442. if jumped then
  443. goupvel.Velocity = goupvel.Velocity + (rootpart.CFrame.rightVector*-20) + Vector3.new(0,5,0)
  444. game.Debris:AddItem(goupvel, 0.25)
  445. for i = 0,0.6 ,0.03 do
  446. if not cananimate then
  447. head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.fromEulerAnglesXYZ(math.rad(10),math.rad(-5),0) * CFrame.new(0,0.5,0),i)
  448. leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1,0) * CFrame.fromEulerAnglesXYZ(-math.rad(40),0,math.rad(-2)) * CFrame.new(0,-1,0),i)
  449. rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1,0) * CFrame.fromEulerAnglesXYZ(math.rad(40),0,math.rad(2)) * CFrame.new(0,-1,0),i)
  450. humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.fromEulerAnglesXYZ(math.rad(-10),0,math.rad(10)),i)
  451. leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,-0.5) * CFrame.fromEulerAnglesXYZ(math.pi/2+math.rad(20),0,0) * CFrame.new(0,-0.5,0),i)
  452. rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(-math.pi/3,0,0) * CFrame.new(0,-0.5,0),i)
  453. runservice.Stepped:wait()
  454. end
  455. end
  456. else
  457. goupvel:destroy()
  458. end
  459. humanoid.AutoRotate = true
  460. cananimate = true
  461. cando = true
  462. elseif what == "hwallrunleft" and anim == "jumprun" or anim == "fallrun" and rayepos ~= nil then
  463. cananimate = false
  464. cando = false
  465. humanoid.AutoRotate = false
  466. local action = Instance.new("BoolValue", character)
  467. action.Name = "hwallrunleft"
  468. rootpart.CFrame = CFrame.new(rayepos, rayepos + rayesurface) * CFrame.fromEulerAnglesXYZ(0,math.pi/2,0)
  469. rootpart.CFrame = rootpart.CFrame * CFrame.new(1.8,0,0)
  470. if rootpart:findFirstChild("wallrunvel") then
  471. rootpart:findFirstChild("wallrunvel"):destroy()
  472. end
  473. local goupvel = Instance.new("BodyVelocity", rootpart)
  474. goupvel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  475. goupvel.Velocity = rootpart.CFrame.lookVector * 20
  476. goupvel.Name = "wallrunvel"
  477. runsound.PlaybackSpeed = 1.7
  478. runsound.Volume = 0.3
  479. local jumped = false
  480. local shouldcontinue = true
  481. local candothat = true
  482. for i = 1,20 do
  483. local rootrightray = Ray.new(rootpart.CFrame.p, rootpart.CFrame.rightVector * -2.5)
  484. local wallrighthit, rootrightraypos = workspace:FindPartOnRayWithIgnoreList(rootrightray, {owner.Character})
  485. if not wallrighthit then
  486. shouldcontinue = false
  487. break
  488. end
  489. local rootfrontray = Ray.new(rootpart.CFrame.p, rootpart.CFrame.lookVector * 4)
  490. local rootfrontrayhit, rootfrontraypos = workspace:FindPartOnRayWithIgnoreList(rootfrontray, {owner.Character})
  491. if rootfrontrayhit then
  492. shouldcontinue = false
  493. break
  494. end
  495. humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.fromEulerAnglesXYZ(0,0,math.rad(-30)),0.3)
  496. head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.Angles(0,0,0) * CFrame.new(0,0.5,0),0.3)
  497. leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.Angles(0,0,-math.pi/1.5) * CFrame.new(0,-0.5,0),0.3)
  498. rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.Angles(-math.sin(tick()*14)*1.3,0,math.rad(15)) * CFrame.new(0,-0.5,0),0.3)
  499. leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1+math.cos(tick()*14)/2,-math.cos(tick()*14)/2) * CFrame.fromEulerAnglesXYZ(math.sin(tick()*14),0,0) * CFrame.new(0,-1,0),0.2)
  500. rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1-math.cos(tick()*14)/2,math.cos(tick()*14)/2) * CFrame.fromEulerAnglesXYZ(-math.sin(tick()*14),0,0) * CFrame.new(0,-1,0),0.2)
  501. runservice.Stepped:wait()
  502. end
  503. for i = 1,60 do
  504. if candothat then
  505. if not shouldcontinue then
  506. break
  507. end
  508. if humanoid.Jump then
  509. jumped = true
  510. break
  511. end
  512. local rootrightray = Ray.new(rootpart.CFrame.p, rootpart.CFrame.rightVector * -2.5)
  513. local wallrighthit, rootrightraypos = workspace:FindPartOnRayWithIgnoreList(rootrightray, {owner.Character})
  514. if not wallrighthit then
  515. break
  516. end
  517. local rootfrontray = Ray.new(rootpart.CFrame.p, rootpart.CFrame.lookVector * 4)
  518. local rootfrontrayhit, rootfrontraypos = workspace:FindPartOnRayWithIgnoreList(rootfrontray, {owner.Character})
  519. if rootfrontrayhit then
  520. break
  521. end
  522. humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.fromEulerAnglesXYZ(0,0,math.rad(-30)),0.3)
  523. head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.Angles(0,0,0) * CFrame.new(0,0.5,0),0.3)
  524. leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.Angles(0,0,-math.pi/1.5) * CFrame.new(0,-0.5,0),0.3)
  525. rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.Angles(-math.sin(tick()*14)*1.3,0,math.rad(15)) * CFrame.new(0,-0.5,0),0.3)
  526. leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1+math.cos(tick()*14)/2,-math.cos(tick()*14)/2) * CFrame.fromEulerAnglesXYZ(math.sin(tick()*14),0,0) * CFrame.new(0,-1,0),0.2)
  527. rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1-math.cos(tick()*14)/2,math.cos(tick()*14)/2) * CFrame.fromEulerAnglesXYZ(-math.sin(tick()*14),0,0) * CFrame.new(0,-1,0),0.2)
  528. runservice.Stepped:wait()
  529. end
  530. end
  531. action:destroy()
  532. candothat = false
  533. if jumped then
  534. goupvel.Velocity = goupvel.Velocity + (rootpart.CFrame.rightVector*20) + Vector3.new(0,5,0)
  535. game.Debris:AddItem(goupvel, 0.25)
  536. for i = 0,0.6 ,0.03 do
  537. if not cananimate then
  538. head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.fromEulerAnglesXYZ(math.rad(10),math.rad(-5),0) * CFrame.new(0,0.5,0),i)
  539. leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1,0) * CFrame.fromEulerAnglesXYZ(-math.rad(40),0,math.rad(-2)) * CFrame.new(0,-1,0),i)
  540. rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1,0) * CFrame.fromEulerAnglesXYZ(math.rad(40),0,math.rad(2)) * CFrame.new(0,-1,0),i)
  541. humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.fromEulerAnglesXYZ(math.rad(-10),0,math.rad(-10)),i)
  542. leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,-0.5) * CFrame.fromEulerAnglesXYZ(-math.pi/3,0,0) * CFrame.new(0,-0.5,0),i)
  543. rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.pi/2+math.rad(20),0,0) * CFrame.new(0,-0.5,0),i)
  544. runservice.Stepped:wait()
  545. end
  546. end
  547. else
  548. goupvel:destroy()
  549. end
  550. humanoid.AutoRotate = true
  551. cananimate = true
  552. cando = true
  553. elseif what == "triggerroll" then
  554. if roll then
  555. roll = false
  556. elseif not roll then
  557. roll = true
  558. end
  559. end
  560. end
  561. end)
  562. coroutine.wrap(function()
  563. while runservice.Stepped:wait() do
  564. if rootpart.Velocity.x >= 2 or rootpart.Velocity.x <= -2 or rootpart.Velocity.z >= 2 or rootpart.Velocity.z <= -2 then
  565. if humanoid.FloorMaterial == Enum.Material.Air then
  566. if rootpart.Velocity.x >= 16 or rootpart.Velocity.x <= -16 or rootpart.Velocity.z >= 16 or rootpart.Velocity.z <= -16 then
  567. if rootpart.Velocity.y >= 3 then
  568. anim = "jumprun"
  569. --print("jumping (running)")
  570. elseif rootpart.Velocity.y <= -3 then
  571. anim = "fallrun"
  572. --("falling (running)")
  573. end
  574. else
  575. if rootpart.Velocity.y >= 3 then
  576. anim = "jump"
  577. --print("jumping (walking)")
  578. elseif rootpart.Velocity.y <= -3 then
  579. anim = "fall"
  580. --print("falling (walking)")
  581. end
  582. end
  583. else
  584. if rootpart.Velocity.x >= 16 or rootpart.Velocity.x <= -16 or rootpart.Velocity.z >= 16 or rootpart.Velocity.z <= -16 then
  585. anim = "run"
  586. --print("running")
  587. else
  588. anim = "walk"
  589. --print("walking")
  590. end
  591. end
  592. elseif rootpart.Velocity.x <= 2 or rootpart.Velocity.x >= -2 or rootpart.Velocity.z <= 2 or rootpart.Velocity.z >= -2 then
  593. if humanoid.FloorMaterial == Enum.Material.Air then
  594. if rootpart.Velocity.y >= 3 then
  595. anim = "jump"
  596. --print("jumping (standing)")
  597. elseif rootpart.Velocity.y < -3 then
  598. anim = "fall"
  599. --print("falling (standing)")
  600. end
  601. else
  602. anim = "idle"
  603. --print("standing")
  604. end
  605. end
  606. end
  607. end)()
  608. coroutine.wrap(function()
  609. while runservice.Stepped:wait() do
  610. if rootpart.Velocity.y < -90 then
  611. while rootpart.Velocity.y < 0 and rootpart.Velocity.y >= -135 and runservice.Stepped:wait() do
  612. print("falling")
  613. end
  614. if rootpart.Velocity.y >= -135 then
  615. cananimate = false
  616. if not roll then
  617. print('hit ground')
  618. roll = false
  619. runsound.Volume = 0
  620. bodyhitsound.TimePosition = 0
  621. bodyhitsound:Play()
  622. local action = Instance.new("BoolValue", character)
  623. action.Name = "ouchfell"
  624. humanoid.WalkSpeed = 0.4
  625. humanoid.JumpPower = 0
  626. humanoid.Health = humanoid.Health - math.random(10,20)
  627. for i = 0,1 , 0.04 do
  628. rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.03661776, -0.287070274, -0.937994003, 1, 2.13205098e-09, 1.80749957e-08, 2.98023224e-08, 0.642787397, -0.766044438, 4.47034836e-08, 0.766044438, 0.642787457),i)
  629. leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5, 0.00759601593, -0.0868253708, 1.00000012, 4.17280432e-09, 2.23762484e-08, 3.55271368e-15, 0.98480767, -0.173648164, 2.98023224e-08, 0.173648179, 0.98480773),i)
  630. leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.188133717, -0.968682289, -0.200000763, 0.939692676, -0.342020154, 2.98023224e-08, 0.342020094, 0.939692557, -8.8817842e-16, 2.7206255e-08, -7.1326367e-09, 1),i)
  631. rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5, -2, -9.53674316e-07, 1.00000012, 3.55271368e-15, 2.98023224e-08, 3.55271368e-15, 0.99999994, -8.8817842e-16, 2.98023224e-08, -8.8817842e-16, 1),i)
  632. humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.new(0.138917923, -1.81215382, -0.199999809, -0.17364794, 0, 0.984807789, -0.984807849, -4.37113883e-08, -0.173647955, 4.3047315e-08, -1, 7.59039409e-09),i)
  633. head.C0 = head.C0:lerp(CFrame.new(0, 1.3184042, -0.620952606, 1.00000012, -2.15236486e-08, 7.42341655e-09, 3.55271368e-15, 0.499999791, 0.866025388, 2.98023224e-08, -0.866025388, 0.499999791),i)
  634. runservice.Stepped:wait()
  635. end
  636. wait(0.7)
  637. for i = 0,0.5 , 0.005 do
  638. rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.43661785, 0.8717556, -1.1015135, 0.99999994, -1.49011354e-08, 2.58095625e-08, 2.98023171e-08, -0.342020303, -0.939692438, 1.49011914e-08, 0.939692736, -0.342020363),i)
  639. leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5, 0.691013336, -1.08328879, 1, 1.29770106e-14, -3.44476568e-15, -1.36212808e-15, -0.173648149, -0.98480767, 2.84217094e-14, 0.984807968, -0.173648193),i)
  640. leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5, -0.697739601, -0.911438107, 0.99999994, 6.67691635e-15, 1.17806545e-14, -1.36212851e-15, 0.939692438, -0.342020303, 2.84217094e-14, 0.342020422, 0.939692795),i)
  641. rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.500000954, -1.51961517, -1.30000019, 1, 6.15348006e-15, 1.0658141e-14, -1.36212808e-15, 0.866025329, -0.49999997, 2.84217094e-14, 0.500000119, 0.866025627),i)
  642. humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.new(0.138917923, -0.812153816, -0.199999809, 1, 0, -1.93715096e-07, 1.93715096e-07, -4.37113883e-08, 1.00000012, -7.10542736e-15, -1, -4.37113883e-08),i)
  643. head.C0 = head.C0:lerp(CFrame.new(0, 1.56080723, -0.0747625828, 1, -3.66066168e-15, 2.96555518e-14, -1.36212808e-15, 0.98480767, 0.173648074, 2.84217094e-14, -0.173648104, 0.984807909),i)
  644. runservice.Stepped:wait()
  645. end
  646. humanoid.JumpPower = 50
  647. game.Debris:AddItem(action, 0.3)
  648. cananimate = true
  649. else
  650. local action = Instance.new("BoolValue", character)
  651. action.Name = "rollin"
  652. print("roll hit ground")
  653. local rotva = 0
  654. coroutine.wrap(function()
  655. humanoidrootpart.C0 = CFrame.new(0,-1.5,0)
  656. for i = 1,25 do
  657. humanoidrootpart.C0 = humanoidrootpart.C0 * CFrame.fromEulerAnglesXYZ(math.rad(-12),0,0)
  658. runservice.Stepped:wait()
  659. end
  660. action:destroy()
  661. cananimate = true
  662. end)()
  663. for i = 0,1 , 0.04 do
  664. rightarm.C0 = rightarm.C0:lerp(CFrame.new(0.5, 0.41317749, -1.40775204, 1.12057243e-08, 1, 4.07854905e-09, 0.173648134, 2.0707327e-09, -0.984807491, -0.984807551, 1.17437136e-08, -0.173648149),i)
  665. leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5, 0.178607941, -0.38302207, 1, 0, 0, 0, 0.642787397, -0.766044199, 0, 0.766044259, 0.642787457),i)
  666. leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5, -0.93637085, -0.903905869, 1, 0, 0, 0, 0.642787278, 0.766044319, 0, -0.766044378, 0.642787337),i)
  667. rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5, -1.08567047, -0.913578272, 1, 0, 0, 0, 0.642787516, 0.76604408, 0, -0.76604414, 0.642787576),i)
  668. head.C0 = head.C0:lerp(CFrame.new(0, 1.30701828, -0.629077435, 1, 0, 0, 0, 0.438599855, 0.898682296, 0, -0.898682296, 0.438599855),i)
  669. runservice.Stepped:wait()
  670. end
  671. end
  672. elseif rootpart.Velocity.y < -666 then
  673. fallingtodeath = true
  674. local action = Instance.new("BoolValue", character)
  675. action.Name = "FALLING"
  676. local i = 0
  677. while rootpart.Velocity.y < -10 and runservice.Stepped:wait() do
  678. fallingsound.Volume = fallingsound.Volume + 0.06
  679. i = i + 1
  680. humanoidrootpart.C0 = humanoidrootpart.C0 * CFrame.fromEulerAnglesXYZ(math.rad(1.5),math.rad(0.5),math.rad(1))
  681. head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.Angles(math.rad(-10),0,0) * CFrame.new(0,0.5,0),0.2)
  682. leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.Angles(math.pi/2+math.sin(i/5)*1.8,0,math.cos(i/5)/3) * CFrame.new(0,-0.7,0),0.2)
  683. rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.Angles(math.pi/2+math.sin(i/4.5)*1.8,0,-math.cos(i/5)/3) * CFrame.new(0,-0.7,0),0.2)
  684. leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1-math.cos(i/5)/2,0) * CFrame.Angles(-math.sin(i/5),0,0) * CFrame.new(0,-1,0),0.2)
  685. rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1+math.cos(i/5)/2,0) * CFrame.Angles(math.sin(i/5),0,0) * CFrame.new(0,-1,0),0.2)
  686. --print('death falling')
  687. end
  688. character:BreakJoints()
  689. print('hit ground death')
  690. end
  691. end
  692. end
  693. end)()
  694. while runservice.Stepped:wait() do
  695. if cananimate and not fallingtodeath then
  696. runsound.Volume = 0
  697. if anim == "idle" then
  698. head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.fromEulerAnglesXYZ(0,math.rad(-5),0) * CFrame.new(0,0.5,0),0.2)
  699. leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1-math.cos(tick())/15,0) * CFrame.fromEulerAnglesXYZ(0,0,math.rad(-2)) * CFrame.new(0,-1,0),0.2)
  700. rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1-math.cos(tick())/15,0) * CFrame.fromEulerAnglesXYZ(0,0,math.rad(2)) * CFrame.new(0,-1,0),0.2)
  701. humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.new(0,math.cos(tick())/15,0) * CFrame.fromEulerAnglesXYZ(0,math.rad(5),0),0.2)
  702. leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0,math.rad(-5)-math.sin(tick())/20) * CFrame.new(0,-0.5,0),0.2)
  703. rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0,math.rad(5)+math.sin(tick())/20) * CFrame.new(0,-0.5,0),0.2)
  704. elseif anim == "walk" then
  705. runsound.Volume = 0.4
  706. runsound.PlaybackSpeed = 1.1
  707. head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.fromEulerAnglesXYZ(0,0,0) * CFrame.new(0,0.5,0),0.2)
  708. leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1+math.cos(tick()*12)/4,-math.cos(tick()*12)/1.5) * CFrame.fromEulerAnglesXYZ(math.sin(tick()*12)*1.5,0,0) * CFrame.new(0,-1,0),0.2)
  709. rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1-math.cos(tick()*12)/4,math.cos(tick()*12)/1.5) * CFrame.fromEulerAnglesXYZ(-math.sin(tick()*12)*1.5,0,0) * CFrame.new(0,-1,0),0.2)
  710. humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.new(0,math.sin(tick()*24)/12,0) * CFrame.fromEulerAnglesXYZ(-math.rad(5),0,0),0.2)
  711. leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.3+math.sin(tick()*12)/3,-0.2+math.sin(tick()*12)/2) * CFrame.fromEulerAnglesXYZ(math.rad(40)-math.sin(tick()*12)*2,0,-math.sin(tick()*12)/2.5) * CFrame.new(0,-0.5,0),0.2)
  712. rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.3-math.sin(tick()*12)/3,-0.2-math.sin(tick()*12)/2) * CFrame.fromEulerAnglesXYZ(math.rad(40)+math.sin(tick()*12)*2,0,-math.sin(tick()*12)/2.5) * CFrame.new(0,-0.5,0),0.2)
  713. elseif anim == "run" then
  714. runsound.Volume = 1
  715. runsound.PlaybackSpeed = 1.4
  716. head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.fromEulerAnglesXYZ(math.rad(10),0,0) * CFrame.new(0,0.5,0),0.2)
  717. leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1+math.cos(tick()*12)/2,-math.cos(tick()*12)/1.5) * CFrame.fromEulerAnglesXYZ(math.sin(tick()*12)*1.4,0,0) * CFrame.new(0,-1,0),0.2)
  718. rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1-math.cos(tick()*12)/2,math.cos(tick()*12)/1.5) * CFrame.fromEulerAnglesXYZ(-math.sin(tick()*12)*1.4,0,0) * CFrame.new(0,-1,0),0.2)
  719. humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.new(0,-0.2+math.sin(tick()*24)/10,0) * CFrame.fromEulerAnglesXYZ(0,math.rad(-rootpart.Orientation.y),0) * CFrame.fromEulerAnglesXYZ(humanoid.MoveDirection.z/5,0,-humanoid.MoveDirection.x/5) * CFrame.fromEulerAnglesXYZ(0,math.rad(rootpart.Orientation.y),0) * CFrame.fromEulerAnglesXYZ(-math.rad(10),0,0),0.2)
  720. leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.rad(10)-math.sin(tick()*12)*1.9,0,-math.sin(tick()*12)/2.5) * CFrame.new(0,-0.7,0),0.2)
  721. rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.rad(10)+math.sin(tick()*12)*1.9,0,-math.sin(tick()*12)/2.5) * CFrame.new(0,-0.7,0),0.2)
  722. elseif anim == "jumprun" or anim == "fallrun" then
  723. if not roll then
  724. head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.fromEulerAnglesXYZ(math.rad(20),math.rad(-5),0) * CFrame.new(0,0.5,0),0.2)
  725. leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1-math.cos(tick())/15,0) * CFrame.fromEulerAnglesXYZ(math.sin(tick()*2),0,math.rad(-2)) * CFrame.new(0,-1,0),0.2)
  726. rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1-math.cos(tick())/15,0) * CFrame.fromEulerAnglesXYZ(-math.sin(tick()*2),0,math.rad(2)) * CFrame.new(0,-1,0),0.2)
  727. humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.new(0,math.cos(tick())/15,0) * CFrame.fromEulerAnglesXYZ(math.rad(-20),math.rad(5),0),0.2)
  728. leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(-math.pi/3+math.sin(tick()*2)/5,0,math.cos(tick()*2)/5) * CFrame.new(0,-0.5,0),0.2)
  729. rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.pi/2+math.rad(20)+math.sin(tick()*2)/5,0,-math.cos(tick()*2)/5) * CFrame.new(0,-0.5,0),0.2)
  730. else
  731. head.C0 = head.C0:lerp(CFrame.new(0, 1.38302183, -0.321395874, 1, 0, 0, 0, 0.766044259, 0.642787695, 0, -0.642787695, 0.766044259),0.2)
  732. leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5, -2.00000048, 3.81469727e-06, 1, 0, 0, 0, 0.99999994, 0, 0, 1.49011612e-08, 1),0.2)
  733. rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5, -2.00000048, 3.81469727e-06, 1, 0, 0, 0, 0.99999994, 0, 0, 1.49011612e-08, 1),0.2)
  734. humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.984807789, 0.17364797, 0, -0.17364797, 0.984807789),0.2)
  735. leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.18301296, -0.0232186317, -0.439029694, 0.866025329, -0.49999997, 0, 0.383022159, 0.663413882, -0.642787457, 0.321393758, 0.556670368, 0.766044438),0.2)
  736. rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.18301296, -0.0232186317, -0.439029694, 0.866025388, 0.5, 0, -0.3830221, 0.663413823, -0.642787635, -0.321393877, 0.556670487, 0.766044259),0.2)
  737. end
  738. elseif anim == "jump" or anim == "fall" then
  739. head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.fromEulerAnglesXYZ(0,0,0) * CFrame.new(0,0.5,0),0.2)
  740. leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,0,-0.5) * CFrame.fromEulerAnglesXYZ(0,0,math.rad(-2)) * CFrame.new(0,-1,0),0.2)
  741. rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1,0) * CFrame.fromEulerAnglesXYZ(0,0,math.rad(2)) * CFrame.new(0,-1,0),0.2)
  742. humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.new(0,math.cos(tick())/15,0) * CFrame.fromEulerAnglesXYZ(0,0,0),0.2)
  743. leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.pi-math.rad(30),0,0) * CFrame.new(0,-0.5,0),0.2)
  744. rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.pi-math.rad(30),0,0) * CFrame.new(0,-0.5,0),0.2)
  745. end
  746. end
  747. end
Add Comment
Please, Sign In to add comment