Advertisement
vL4d_4eVer

anims

Jan 26th, 2019
651
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 21.81 KB | None | 0 0
  1. --BasicFunctions
  2. local ins = Instance.new
  3. local v3 = Vector3.new
  4. local cf = CFrame.new
  5. local angles = CFrame.Angles
  6. local rad = math.rad
  7. local huge = math.huge
  8. local cos = math.cos
  9. local sin = math.sin
  10. local tan = math.tan
  11. local ray = Ray.new
  12. local random = math.random
  13. local ud = UDim.new
  14. local ud2 = UDim2.new
  15. local c3 = Color3.new
  16. local rgb = Color3.fromRGB
  17. local bc = BrickColor.new
  18.  
  19. --Variables
  20. local char = owner.Character
  21. local h = char.Head
  22. local t = char.Torso
  23. local ra = char["Right Arm"]
  24. local la = char["Left Arm"]
  25. local rl = char["Right Leg"]
  26. local ll = char["Left Leg"]
  27. local rut = char.HumanoidRootPart
  28. local hum = char:FindFirstChildOfClass("Humanoid")
  29. local necno = t.Neck
  30. local rutjno = rut.RootJoint
  31. local rsno = t["Right Shoulder"]
  32. local lsno = t["Left Shoulder"]
  33. local rhno = t["Right Hip"]
  34. local lhno = t["Left Hip"]
  35. --
  36. local change = 1
  37. local sine = 0
  38. local animspeed = .1
  39. local idledevider = 12.5
  40. local maxlegdist = 1.35
  41. local rlegdist
  42. local llegdist
  43. local sitting = false
  44. local laying = false
  45. local slow = true
  46. local ruined = false
  47. local holdingtool = false
  48. local using = false
  49. local anim = "idle"
  50. local asset = "rbxassetid://"
  51. --
  52. local stepsounds = {
  53. Grass = asset.."1201103066",
  54. Sand = asset.."1436385526",
  55. Plastic = asset.."1569994049",
  56. Stone = asset.."1201103555", --379398649
  57. Wood = asset.."1201103959",
  58. Pebble = asset.."1201103211",
  59. Ice = asset.."265653271",
  60. Glass = asset.."145180170",
  61. Metal = asset.."379482691"
  62. }
  63. --
  64. local necc0 = cf(0, 1, 0)
  65. local necc1 = cf(0,-.5,0)
  66. local rsc0 = cf(1, .5, 0)
  67. local rsc1 = cf(-.5, .5, 0)
  68. local lsc0 = cf(-1, .5, 0)
  69. local lsc1 = cf(.5, .5, 0)
  70. local rhc0 = cf(.5,-1,0)*cf(0,1.2,0)
  71. local rhc1 = cf(0,1,0)
  72. local lhc0 = cf(-.5,-1,0)*cf(0,1.2,0)
  73. local lhc1 = cf(0,1,0)
  74. local rutjc0 = cf(0,0,0)
  75. local rutjc1 = cf(0,0,0)
  76.  
  77. if char:FindFirstChild("Animate") then
  78. char.Animate:Destroy()
  79. end
  80. if hum:FindFirstChildOfClass("Animator") then
  81. char.Humanoid.Animator:Destroy()
  82. end
  83. if ruined then
  84.     change = 99999999
  85.     idledevider = .01
  86.     animspeed = .95
  87. end
  88.  
  89. --Creating new joints
  90. local nec = ins("Motor6D",t) nec.Name = "Neck" nec.Part0 = t nec.Part1 = h
  91. local rutj = ins("Motor6D",rut) rutj.Name = "RootJoint" rutj.Part0 = t rutj.Part1 = rut
  92. local rs = ins("Motor6D",t) rs.Name = "Right Shoulder" rs.Part0 = t rs.Part1 = ra
  93. local ls = ins("Motor6D",t) ls.Name = "Left Shoulder" ls.Part0 = t ls.Part1 = la
  94. local rh = ins("Motor6D",t) rh.Name = "Right Hip" rh.Part0 = t rh.Part1 = rl
  95. local lh = ins("Motor6D",t) lh.Name = "Left Hip" lh.Part0 = t lh.Part1 = ll
  96.  
  97. --Removing old joints
  98. necno.Parent = nil
  99. rutjno.Parent = nil
  100. rsno.Parent = nil
  101. lsno.Parent = nil
  102. rhno.Parent = nil
  103. lhno.Parent = nil
  104.  
  105. --Setting CFrames
  106. nec.C1 = necc1
  107. nec.C0 = necc0
  108. rs.C1 = rsc1
  109. rs.C0 = rsc0
  110. ls.C1 = lsc1
  111. ls.C0 = lsc0
  112. rh.C1 = rhc1
  113. rh.C0 = rhc0*cf(0,-1,0)
  114. lh.C1 = lhc1
  115. lh.C0 = lhc0*cf(0,-1,0)
  116. rutj.C1 = rutjc1
  117. rutj.C0 = rutjc0
  118.  
  119. --Some creates
  120. --Models
  121. --Parts
  122. --Welds
  123. --Sounds
  124. local footstepsound = ins("Sound",t)
  125. footstepsound.Volume = 2
  126. footstepsound.SoundId = stepsounds.Grass
  127.  
  128. --Connecting sprint
  129. local rem = ins("RemoteEvent",char) rem.Name = "SprintEvent"
  130. local client = NLS([[
  131. local rem = owner.Character:WaitForChild("SprintEvent")
  132. game:GetService("Players").LocalPlayer:GetMouse().KeyDown:Connect(function(key)
  133. if string.byte(key) == 50 then
  134. rem:FireServer("speed",false)
  135. end
  136. if key == "x" then
  137. rem:FireServer("sit")
  138. end
  139. if key == "c" then
  140. rem:FireServer("lay")
  141. end
  142. end)
  143. game:GetService("Players").LocalPlayer:GetMouse().KeyUp:Connect(function(key)
  144. if string.byte(key) == 50 then
  145. rem:FireServer("speed",true)
  146. end
  147. end)
  148. ]],owner.Character)
  149. rem.OnServerEvent:Connect(function(plr,type,value)
  150. if type == "speed" then
  151. slow = value
  152. elseif type == "sit" then
  153. if not sitting then
  154. sit()
  155. else
  156. unsit()
  157. end
  158. elseif type == "lay" then
  159. if not laying then
  160. lay()
  161. else
  162. unlay()
  163. end
  164. end
  165. end)
  166.  
  167. function swait()
  168. game:GetService("RunService").Stepped:Wait()
  169. end
  170. function rayc(spos,direc,ignore,dist)
  171.     local rai = ray(spos,direc.Unit * dist)
  172.     local rhit,rpos,rrot = workspace:FindPartOnRayWithIgnoreList(rai,ignore,false,false)
  173.     return rhit,rpos,rrot
  174. end
  175. function getdistfrowtorsotowall()
  176.     local ruthit,rutpos,rutrot = rayc(t.Position,t.CFrame.RightVector,{char},2)
  177.     local dist1 = (t.Position-rutpos).Magnitude-2
  178.     local luthit,lutpos,lutrot = rayc(t.Position,-t.CFrame.RightVector,{char},2)
  179.     local dist2 = (t.Position-lutpos).Magnitude-2
  180.     return dist1,dist2
  181. end
  182. function sit()
  183.     if not using then
  184.     sitting = true
  185.     using = true
  186.     anim = "idle"
  187.     if not laying then
  188.     for i = 0,1.5,.025 do
  189.         nec.C0 = nec.C0:Lerp(necc0*cf(0,0,0)*angles(rad(-20),rad(-30),rad(0)),i)
  190.         rs.C0 = rs.C0:Lerp(rsc0*cf(.1,-.5,.1)*angles(rad(-5),rad(-10),rad(20)),i)
  191.         ls.C0 = ls.C0:Lerp(lsc0*cf(0,0,0)*angles(rad(10),rad(0),rad(20)),i)
  192.         rh.C0 = rh.C0:Lerp(rhc0*cf(0,.25,-.3)*angles(rad(0),rad(0),rad(20)),i)
  193.         lh.C0 = lh.C0:Lerp(lhc0*cf(0,-.4,-.5)*angles(rad(0),rad(0),rad(20)),i)
  194.         rutj.C0 = rutj.C0:Lerp(rutjc0*cf(0,1.2,0)*angles(rad(10),rad(0),rad(20)),i)
  195.         swait()
  196.     end
  197.     else
  198.         laying = false
  199.     end
  200.     for i = 0,1.5,.025 do
  201.         nec.C0 = nec.C0:Lerp(necc0*cf(0,0,0)*angles(rad(-20),rad(0),rad(0)),i)
  202.         rs.C0 = rs.C0:Lerp(rsc0*cf(0,-.2,.2)*angles(rad(-45),rad(0),rad(0)),i)
  203.         ls.C0 = ls.C0:Lerp(lsc0*cf(0,-.2,.2)*angles(rad(-45),rad(0),rad(0)),i)
  204.         rh.C0 = rh.C0:Lerp(rhc0*cf(0,-1.1,0)*angles(rad(60),rad(0),rad(5)),i)
  205.         lh.C0 = lh.C0:Lerp(lhc0*cf(0,-1.1,0)*angles(rad(60),rad(0),rad(-5)),i)
  206.         rutj.C0 = rutj.C0:Lerp(rutjc0*cf(0,1.45,-1)*angles(rad(-30),rad(0),rad(0)),i)
  207.         swait()
  208.     end
  209.     using = false
  210.     end
  211. end
  212. function unsit()
  213.     if not using then
  214.     using = true
  215.     for i = 0,1.5,.025 do
  216.         nec.C0 = nec.C0:Lerp(necc0*cf(0,0,0)*angles(rad(-20),rad(-30),rad(0)),i)
  217.         rs.C0 = rs.C0:Lerp(rsc0*cf(.1,-.5,.1)*angles(rad(-5),rad(-10),rad(20)),i)
  218.         ls.C0 = ls.C0:Lerp(lsc0*cf(0,0,0)*angles(rad(10),rad(0),rad(20)),i)
  219.         rh.C0 = rh.C0:Lerp(rhc0*cf(0,.25,-.3)*angles(rad(0),rad(0),rad(20)),i)
  220.         lh.C0 = lh.C0:Lerp(lhc0*cf(0,-.4,-.5)*angles(rad(0),rad(0),rad(20)),i)
  221.         rutj.C0 = rutj.C0:Lerp(rutjc0*cf(0,1.2,0)*angles(rad(10),rad(0),rad(20)),i)
  222.         swait()
  223.     end
  224.     sitting = false
  225.     laying = false
  226.     using = false
  227.     end
  228. end
  229. function lay()
  230.     if not using then
  231.     laying = true
  232.     using = true
  233.     anim = "idle"
  234.     if not sitting then
  235.     for i = 0,1.5,.025 do
  236.         nec.C0 = nec.C0:Lerp(necc0*cf(0,0,0)*angles(rad(-20),rad(-30),rad(0)),i)
  237.         rs.C0 = rs.C0:Lerp(rsc0*cf(.1,-.5,.1)*angles(rad(-5),rad(-10),rad(20)),i)
  238.         ls.C0 = ls.C0:Lerp(lsc0*cf(0,0,0)*angles(rad(10),rad(0),rad(20)),i)
  239.         rh.C0 = rh.C0:Lerp(rhc0*cf(0,.25,-.3)*angles(rad(0),rad(0),rad(20)),i)
  240.         lh.C0 = lh.C0:Lerp(lhc0*cf(0,-.4,-.5)*angles(rad(0),rad(0),rad(20)),i)
  241.         rutj.C0 = rutj.C0:Lerp(rutjc0*cf(0,1.2,0)*angles(rad(10),rad(0),rad(20)),i)
  242.         swait()
  243.     end
  244.     else
  245.         sitting = false
  246.     end
  247.     for i = 0,1.5,.025 do
  248.         nec.C0 = nec.C0:Lerp(necc0*cf(0,0,0)*angles(rad(-25),rad(0),rad(0)),i)
  249.         rs.C0 = rs.C0:Lerp(rsc0*cf(-.3,.25,0)*angles(rad(180),rad(-5),rad(-40)),i)
  250.         ls.C0 = ls.C0:Lerp(lsc0*cf(.3,.25,0)*angles(rad(180),rad(5),rad(40)),i)
  251.         rh.C0 = rh.C0:Lerp(rhc0*cf(0,-1,0)*angles(rad(10),rad(-5),rad(-25)),i)
  252.         lh.C0 = lh.C0:Lerp(lhc0*cf(0,-1,0)*angles(rad(0),rad(0),rad(5)),i)
  253.         rutj.C0 = rutj.C0:Lerp(rutjc0*cf(0,0,-2.495)*angles(rad(-90),rad(5),rad(0)),i)
  254.         swait()
  255.     end
  256.     using = false
  257.     end
  258. end
  259. function unlay()
  260.     if not using then
  261.     using = true
  262.     for i = 0,1.5,.025 do
  263.         nec.C0 = nec.C0:Lerp(necc0*cf(0,0,0)*angles(rad(-20),rad(-30),rad(0)),i)
  264.         rs.C0 = rs.C0:Lerp(rsc0*cf(.1,-.5,.1)*angles(rad(-5),rad(-10),rad(20)),i)
  265.         ls.C0 = ls.C0:Lerp(lsc0*cf(0,0,0)*angles(rad(10),rad(0),rad(20)),i)
  266.         rh.C0 = rh.C0:Lerp(rhc0*cf(0,.25,-.3)*angles(rad(0),rad(0),rad(20)),i)
  267.         lh.C0 = lh.C0:Lerp(lhc0*cf(0,-.4,-.5)*angles(rad(0),rad(0),rad(20)),i)
  268.         rutj.C0 = rutj.C0:Lerp(rutjc0*cf(0,1.2,0)*angles(rad(10),rad(0),rad(20)),i)
  269.         swait()
  270.     end
  271.     laying = false
  272.     sitting = false
  273.     using = false
  274.     end
  275. end
  276. function changesound(hit)
  277. if not ruined then
  278. if hit then
  279.     if hit.Material == Enum.Material.Sand then
  280.         footstepsound.SoundId = stepsounds.Sand
  281.         footstepsound.Volume = 1
  282.     elseif hit.Material == Enum.Material.Grass or hit.Material == Enum.Material.Fabric then
  283.         footstepsound.SoundId = stepsounds.Grass
  284.         footstepsound.Volume = 3
  285.     elseif hit.Material == Enum.Material.Granite or hit.Material == Enum.Material.Slate or hit.Material == Enum.Material.Concrete or hit.Material == Enum.Material.Marble or hit.Material == Enum.Material.Brick or hit.Material == Enum.Material.Cobblestone then
  286.         footstepsound.SoundId = stepsounds.Stone
  287.         footstepsound.Volume = 1
  288.     elseif hit.Material == Enum.Material.Plastic or hit.Material == Enum.Material.SmoothPlastic or hit.Material == Enum.Material.Neon then
  289.         footstepsound.SoundId = stepsounds.Plastic
  290.         footstepsound.Volume = 2
  291.     elseif hit.Material == Enum.Material.Wood or hit.Material == Enum.Material.WoodPlanks then
  292.         footstepsound.SoundId = stepsounds.Wood
  293.         footstepsound.Volume = 1
  294.     elseif hit.Material == Enum.Material.Ice then
  295.         footstepsound.SoundId = stepsounds.Ice
  296.         footstepsound.Volume = 4
  297.     elseif hit.Material == Enum.Material.Pebble then
  298.         footstepsound.SoundId = stepsounds.Pebble
  299.         footstepsound.Volume = 1
  300.     elseif hit.Material == Enum.Material.Glass then
  301.         footstepsound.SoundId = stepsounds.Glass
  302.         footstepsound.Volume = 1
  303.     elseif hit.Material == Enum.Material.Metal or hit.Material == Enum.Material.DiamondPlate or  hit.Material == Enum.Material.CorrodedMetal then
  304.         footstepsound.SoundId = stepsounds.Metal
  305.         footstepsound.Volume = 1
  306.     end
  307.     end
  308. else
  309.     if hit then
  310.     if hit.Material == Enum.Material.Sand then
  311.         footstepsound.SoundId = stepsounds.Sand
  312.         footstepsound.Volume = 10
  313.     elseif hit.Material == Enum.Material.Grass or hit.Material == Enum.Material.Fabric then
  314.         footstepsound.SoundId = stepsounds.Grass
  315.         footstepsound.Volume = 10
  316.     elseif hit.Material == Enum.Material.Granite or hit.Material == Enum.Material.Slate or hit.Material == Enum.Material.Concrete or hit.Material == Enum.Material.Marble or hit.Material == Enum.Material.Brick or hit.Material == Enum.Material.Cobblestone then
  317.         footstepsound.SoundId = stepsounds.Stone
  318.         footstepsound.Volume = 10
  319.     elseif hit.Material == Enum.Material.Plastic or hit.Material == Enum.Material.SmoothPlastic or hit.Material == Enum.Material.Neon then
  320.         footstepsound.SoundId = stepsounds.Plastic
  321.         footstepsound.Volume = 10
  322.     elseif hit.Material == Enum.Material.Wood or hit.Material == Enum.Material.WoodPlanks then
  323.         footstepsound.SoundId = stepsounds.Wood
  324.         footstepsound.Volume = 10
  325.     elseif hit.Material == Enum.Material.Ice then
  326.         footstepsound.SoundId = stepsounds.Ice
  327.         footstepsound.Volume = 10
  328.     elseif hit.Material == Enum.Material.Pebble then
  329.         footstepsound.SoundId = stepsounds.Pebble
  330.         footstepsound.Volume = 10
  331.     elseif hit.Material == Enum.Material.Glass then
  332.         footstepsound.SoundId = stepsounds.Glass
  333.         footstepsound.Volume = 10
  334.     elseif hit.Material == Enum.Material.Metal or hit.Material == Enum.Material.DiamondPlate or  hit.Material == Enum.Material.CorrodedMetal then
  335.         footstepsound.SoundId = stepsounds.Metal
  336.         footstepsound.Volume = 10
  337.     end
  338.     end
  339. end
  340. end
  341.  
  342. local anims = coroutine.wrap(function()
  343. while true do
  344.     if not slow and not sitting and not laying then
  345.         hum.WalkSpeed = 50*(animspeed*10)
  346.         hum.JumpPower = 50
  347.     elseif slow and not sitting and not laying then
  348.         hum.WalkSpeed = 16*(animspeed*10)
  349.         hum.JumpPower = 50
  350.     elseif sitting or laying then
  351.         hum.JumpPower = 0
  352.         hum.WalkSpeed = 0
  353.     end
  354.     if not footstepsound or not footstepsound.Parent then
  355.         footstepsound = ins("Sound",t)
  356.         footstepsound.Volume = 2
  357.         footstepsound.SoundId = stepsounds.Grass
  358.     end
  359.     if char:FindFirstChildOfClass("Tool") then
  360.         holdingtool = true
  361.     else
  362.         holdingtool = false
  363.     end
  364.     local rhit,rpos,rrot = rayc(v3(rl.Position.x,t.Position.y-1.8,rl.Position.z),-rut.CFrame.UpVector,{char},maxlegdist)
  365.     local lhit,lpos,lrot = rayc(v3(ll.Position.x,t.Position.y-1.8,ll.Position.z),-rut.CFrame.UpVector,{char},maxlegdist)
  366.     rlegdist = (v3(rl.Position.x,rut.Position.y-1.8,rl.Position.z)-rpos).Magnitude
  367.     llegdist = (v3(ll.Position.x,rut.Position.y-1.8,ll.Position.z)-lpos).Magnitude
  368.     local rtdist,ltdist = getdistfrowtorsotowall()
  369.     local torot
  370.     if rlegdist > llegdist then
  371.         torot = -rlegdist/15
  372.     elseif rlegdist < llegdist then
  373.         torot = llegdist/15
  374.     elseif rlegdist == llegdist then
  375.         torot = 0
  376.     end
  377.     changesound(hit)
  378.     local hit,pos,rot = rayc(rut.Position,v3(rut.Position.x,-10000,rut.Position.z),{char},4.5)
  379.     sine = sine+change
  380.     local vervel = rut.Velocity.y
  381.     local tvel = (rut.Velocity * v3(1,0,1)).Magnitude
  382.     local Ccf=rut.CFrame
  383.     local Walktest1 = hum.MoveDirection*Ccf.LookVector
  384.     local Walktest2 = hum.MoveDirection*Ccf.RightVector
  385.     local rotfb = Walktest1.X+Walktest1.Z
  386.     local rotrl = Walktest2.X+Walktest2.Z
  387.     local legoff = rotfb
  388.     if rotfb <0 then
  389.         legoff = 0
  390.     end
  391.     if anim == "idle" and hit then
  392.         nec.C1 = nec.C1:Lerp(necc1 * cf(0,0,0)*angles(-sin(sine/idledevider/1.5)*rad(2.5),-cos(sine/idledevider/5)*rad(2.5),rad(0)),animspeed)
  393.         if not sitting and not laying then
  394.         rutj.C1 = rutj.C1:Lerp(rutjc1 * cf(0,sin(sine/idledevider/1.5)/12.5,0)*angles(rad(0),rad(0),rad(0)),animspeed)
  395.         if not holdingtool then
  396.             rs.C1 = rs.C1:Lerp(rsc1 * cf(0,.05+cos(-sine/idledevider/1.5)/17.5,.05+cos(-sine/idledevider/1.5)/17.5)*angles(cos(sine/idledevider/1.5)/1.5*rad(5),cos(sine/idledevider/1.5)/1.5*rad(10),rad(-2.5)),animspeed)
  397.         else
  398.             rs.C1 = rs.C1:Lerp(rsc1 * cf(0,0,-cos(-sine/idledevider/1.5)/17.5),animspeed)
  399.         end
  400.         ls.C1 = ls.C1:Lerp(lsc1 * cf(0,.05+cos(-sine/idledevider/1.5)/17.5,.05+cos(-sine/idledevider/1.5)/17.5)*angles(cos(sine/idledevider/1.5)/1.5*rad(5),-cos(sine/idledevider/1.5)/1.5*rad(10),rad(2.5)),animspeed)
  401.         rh.C1 = rh.C1:Lerp(rhc1 * cf(0,sin(sine/idledevider/1.5)/12.5,0)*angles(rad(0),rad(5),rad(-5)),animspeed)
  402.         lh.C1 = lh.C1:Lerp(lhc1 * cf(0,sin(sine/idledevider/1.5)/12.5,0)*angles(rad(0),rad(-5),rad(5)),animspeed)
  403.         end
  404.         if sitting or laying then
  405.             rutj.C1 = rutj.C1:Lerp(rutjc1,animspeed)
  406.             rs.C1 = rs.C1:Lerp(rsc1,animspeed)
  407.             ls.C1 = ls.C1:Lerp(lsc1,animspeed)
  408.             rh.C1 = rh.C1:Lerp(rhc1,animspeed)
  409.             lh.C1 = lh.C1:Lerp(lhc1,animspeed)
  410.         end
  411.     elseif anim == "sit" then
  412.         nec.C1 = nec.C1:Lerp(necc1 * cf(0,0,0)*angles(-sin(sine/idledevider/1.5)*rad(5),-cos(sine/idledevider/5)*rad(5),rad(0)),animspeed)
  413.         rutj.C1 = rutj.C1:Lerp(rutjc1 * cf(0,sin(sine/idledevider/1.5)/12.5,0)*angles(rad(0),rad(0),rad(0)),animspeed)
  414.         if not holdingtool then
  415.             rs.C1 = rs.C1:Lerp(rsc1 * cf(0,.05+cos(-sine/idledevider/1.5)/17.5,.05+cos(-sine/idledevider/1.5)/17.5)*angles(cos(sine/idledevider/1.5)/1.5*rad(5),cos(sine/idledevider/1.5)/1.5*rad(10),rad(-2.5)),animspeed)
  416.         end
  417.         ls.C1 = ls.C1:Lerp(lsc1 * cf(0,.05+cos(-sine/idledevider/1.5)/17.5,.05+cos(-sine/idledevider/1.5)/17.5)*angles(cos(sine/idledevider/1.5)/1.5*rad(5),-cos(sine/idledevider/1.5)/1.5*rad(10),rad(2.5)),animspeed)
  418.         rh.C1 = rh.C1:Lerp(rhc1 * cf(0,0,-sin(sine/idledevider/1.5)/12.5)*angles(rad(0),rad(5),rad(-5)),animspeed)
  419.         lh.C1 = lh.C1:Lerp(lhc1 * cf(0,0,-sin(sine/idledevider/1.5)/12.5)*angles(rad(0),rad(-5),rad(5)),animspeed)
  420.     elseif anim == "jump" then
  421.         nec.C1 = nec.C1:Lerp(necc1 * cf(0,0,0)*angles(rad(-10),rad(0),rad(0)),animspeed*2.5)
  422.         rutj.C1 = rutj.C1:Lerp(rutjc1 * cf(0,0,0)*angles(-rotfb/4,0,-rotrl/5),animspeed/2)
  423.         if not holdingtool then
  424.             rs.C1 = rs.C1:Lerp(rsc1 * cf(.3,.3,0)*angles(rad(0),rad(-10),rad(-80)),animspeed*2.5)
  425.         end
  426.         ls.C1 = ls.C1:Lerp(lsc1 * cf(-.3,.3,0)*angles(rad(0),rad(10),rad(80)),animspeed*2.5)
  427.         rh.C1 = rh.C1:Lerp(rhc1 * cf(0,-.7,.25)*angles(rad(15),rad(10),rad(0)),animspeed*2.5)
  428.         lh.C1 = lh.C1:Lerp(lhc1 * cf(0,-.3,.3)*angles(rad(-10),rad(-10),rad(0)),animspeed*2.5)
  429.     elseif anim == "fall" then
  430.         nec.C1 = nec.C1:Lerp(necc1 * cf(0,0,0)*angles(rad(20),rad(0),rad(0)),animspeed/15)
  431.         rutj.C1 = rutj.C1:Lerp(rutjc1 * cf(0,0,0)*angles(-rotfb/3,0,-rotrl/4),animspeed/2)
  432.         if not holdingtool then
  433.             rs.C1 = rs.C1:Lerp(rsc1 * cf(.4,.5,0)*angles(rad(0),rad(-20),rad(-130)),animspeed/15)
  434.         end
  435.         ls.C1 = ls.C1:Lerp(lsc1 * cf(-.4,.5,0)*angles(rad(0),rad(20),rad(130)),animspeed/15)
  436.         rh.C1 = rh.C1:Lerp(rhc1 * cf(0,-.4,.2)*angles(rad(10),rad(10),rad(0)),animspeed/15)
  437.         lh.C1 = lh.C1:Lerp(lhc1 * cf(0,-.1,.25)*angles(rad(-5),rad(-10),rad(0)),animspeed/15)
  438.     elseif anim == "walk" and not slow and hit then
  439.         for i = 0,1,animspeed-(animspeed/5) do
  440.             changesound(hit)
  441.             if not holdingtool then
  442.                 rs.C0 = rs.C0:Lerp(rsc0 * cf(rtdist/1.75,0,rtdist/4.5) * angles(0,-rtdist/1.5,0),.025)
  443.             else
  444.                 rs.C0 = rs.C0:Lerp(rsc0 * cf(0,0,0) * angles(rad(90),0,0),.025)
  445.             end
  446.             nec.C1 = nec.C1:Lerp(necc1 * cf(0,0,0)*angles(-rotfb/4.5+cos(sine/5)*rad(2.5)*rotfb,cos(sine/5)*rad(2.5)+rotrl/2,-cos(sine/5)*rad(5)),animspeed)
  447.             rutj.C1 = rutj.C1:Lerp(rutjc1 * cf(0,sin(sine/2.5)/6.5,0)*angles(cos(sine/5)*3*rad(2.5)*rotfb,cos(sine/5)*3*rad(5),0)*angles(-rotfb/3,0,-rotrl/4),animspeed)
  448.             if not holdingtool then
  449.                 rs.C1 = rs.C1:Lerp(rsc1 * cf(0,.05-cos(-sine/5)/5,.05-cos(-sine/5)/5)*angles(rad(5)+cos(sine/5)*3*rad(50)*rotfb,sin(sine/5)*3*rad(12.5),-.075),animspeed)
  450.             end
  451.             ls.C1 = ls.C1:Lerp(lsc1 * cf(0,.05+cos(-sine/5)/5,.05+cos(-sine/5)/5)*angles(rad(5)-cos(sine/5)*3*rad(50)*rotfb,sin(sine/5)*3*rad(12.5),.075),animspeed)
  452.             rh.C1 = rh.C1:Lerp(rhc1 * cf(0,sin(sine/5),cos(sine/5)*1.15*legoff)*angles(-cos(sine/5)*3*rad(50)*rotfb,sin(sine/5)*3*rad(5),-.05-cos(sine/5)*3*rad(30)*rotrl),animspeed)
  453.             lh.C1 = lh.C1:Lerp(lhc1 * cf(0,-sin(sine/5),-cos(sine/5)*1.15*legoff)*angles(cos(sine/5)*3*rad(50)*rotfb,sin(sine/5)*3*rad(5),.05+cos(sine/5)*3*rad(30)*rotrl),animspeed)
  454.             sine = sine +change
  455.             swait()
  456.         end
  457.         footstepsound:Play()
  458.     elseif anim == "walk" and slow and hit then
  459.         for i = 0,1,animspeed-(animspeed/2.2) do
  460.             changesound(hit)
  461.             if not holdingtool then
  462.                 rs.C0 = rs.C0:Lerp(rsc0 * cf(rtdist/1.75,0,rtdist/4.5) * angles(0,-rtdist/1.5,0),.25)
  463.             else
  464.                 rs.C0 = rs.C0:Lerp(rsc0 * cf(0,0,0) * angles(rad(90),0,0),.25)
  465.             end
  466.             nec.C1 = nec.C1:Lerp(necc1 * cf(0,0,0)*angles(-rotfb/5.5+cos(sine/3.25)*rad(2.5),rotrl/2.75,cos(sine/3.25)*rad(2.5)),animspeed)
  467.             rutj.C1 = rutj.C1:Lerp(rutjc1 * cf(0,sin(sine/3.25)/8.5,0)*angles(cos(sine/7.5)*rad(2.5),0,0)*angles(-rotfb/5,0,-rotrl/5),animspeed)
  468.             if not holdingtool then
  469.                 rs.C1 = rs.C1:Lerp(rsc1 * cf(0,0,0)*angles(rad(5)+cos(sine/7.5)*2*rad(30)*rotfb,-sin(sine/7.5)*2*rad(7.5),-.075),animspeed)
  470.             end
  471.             ls.C1 = ls.C1:Lerp(lsc1 * cf(0,0,0)*angles(rad(5)-cos(sine/7.5)*2*rad(30)*rotfb,-sin(sine/7.5)*2*rad(7.5),.075),animspeed)
  472.             rh.C1 = rh.C1:Lerp(rhc1 * cf(0,sin(sine/7.5)/4,cos(sine/7.5)/2*legoff)*angles(-cos(sine/7.5)*rad(50)*rotfb,sin(sine/7.5)*2*rad(5),-.05-cos(sine/7.5)*2*rad(20)*rotrl),animspeed)
  473.             lh.C1 = lh.C1:Lerp(lhc1 * cf(0,-sin(sine/7.5)/3,-cos(sine/7.5)/2*legoff)*angles(cos(sine/7.5)*rad(50)*rotfb,sin(sine/7.5)*2*rad(5),.05+cos(sine/7.5)*2*rad(20)*rotrl),animspeed)
  474.             sine = sine +change
  475.             swait()
  476.         end
  477.         footstepsound:Play()
  478.     end
  479.     if not sitting and not laying then
  480.     if tvel >2 and vervel <2 and vervel >-2 then
  481.         anim = "walk"
  482.         nec.C0 = nec.C0:Lerp(necc0,.1)
  483.         if not holdingtool then
  484.             rs.C0 = rs.C0:Lerp(rsc0 * cf(rtdist/1.75,0,rtdist/4.5) * angles(0,-rtdist/1.5,0),.1)
  485.         else
  486.             rs.C0 = rs.C0:Lerp(rsc0 * cf(0,0,0) * angles(rad(90),0,0),.1)
  487.         end
  488.         ls.C0 = ls.C0:Lerp(lsc0,.1)
  489.         rh.C0 = rh.C0:Lerp(rhc0 * cf(0,-rlegdist,-(maxlegdist-rlegdist)/4)*angles(-(maxlegdist-rlegdist)/5,0,0),.1)
  490.         lh.C0 = lh.C0:Lerp(lhc0 * cf(0,-llegdist,-(maxlegdist-llegdist)/4)*angles(-(maxlegdist-llegdist)/5,0,0),.1)
  491.         rutj.C0 = rutj.C0:Lerp(rutjc0,.1)
  492.     elseif hum.Sit == true then
  493.         anim = "sit"
  494.         nec.C0 = nec.C0:Lerp(necc0,.1)
  495.         if not holdingtool then
  496.             rs.C0 = rs.C0:Lerp(rsc0 * cf(rtdist/1.75,0,rtdist/4.5) * angles(0,-rtdist/1.5,0),.1)
  497.         else
  498.             rs.C0 = rs.C0:Lerp(rsc0 * cf(0,0,0) * angles(rad(90),0,0),.1)
  499.         end
  500.         ls.C0 = ls.C0:Lerp(lsc0,.1)
  501.         rh.C0 = rh.C0:Lerp(rhc0 * cf(0,-1,0) * angles(rad(90),0,0),.1)
  502.         lh.C0 = lh.C0:Lerp(lhc0 * cf(0,-1,0) * angles(rad(90),0,0),.1)
  503.         rutj.C0 = rutj.C0:Lerp(rutjc0*angles(0,0,-torot),.1)
  504.     elseif vervel >2 then
  505.         anim = "jump"
  506.         nec.C0 = nec.C0:Lerp(necc0,.1)
  507.         if not holdingtool then
  508.             rs.C0 = rs.C0:Lerp(rsc0 * cf(rtdist/1.75,0,rtdist/4.5) * angles(0,-rtdist/1.5,0),.1)
  509.         else
  510.             rs.C0 = rs.C0:Lerp(rsc0 * cf(0,0,0) * angles(rad(90),0,0),.1)
  511.         end
  512.         ls.C0 = ls.C0:Lerp(lsc0,.1)
  513.         rh.C0 = rh.C0:Lerp(rhc0 * cf(0,-rlegdist,-(maxlegdist-rlegdist)/3.5)*angles(-(maxlegdist-rlegdist)/6.5,0,0),.1)
  514.         lh.C0 = lh.C0:Lerp(lhc0 * cf(0,-llegdist,-(maxlegdist-llegdist)/3.5)*angles(-(maxlegdist-llegdist)/6.5,0,0),.1)
  515.         rutj.C0 = rutj.C0:Lerp(rutjc0*angles(0,0,-torot),.1)
  516.     elseif vervel <-2 then
  517.         anim = "fall"
  518.         nec.C0 = nec.C0:Lerp(necc0,.1)
  519.         if not holdingtool then
  520.             rs.C0 = rs.C0:Lerp(rsc0 * cf(rtdist/1.75,0,rtdist/4.5) * angles(0,-rtdist/1.5,0),.1)
  521.         else
  522.             rs.C0 = rs.C0:Lerp(rsc0 * cf(rtdist/1.75,0,rtdist/4.5) * angles(rad(90),-rtdist/1.5,0),.1)
  523.         end
  524.         ls.C0 = ls.C0:Lerp(lsc0 * cf(-ltdist/1.75,0,ltdist/4.5) * angles(0,ltdist/1.5,0),.1)
  525.         rh.C0 = rh.C0:Lerp(rhc0 * cf(0,-rlegdist,-(maxlegdist-rlegdist)/3.5)*angles(-(maxlegdist-rlegdist)/6.5,0,0),.1)
  526.         lh.C0 = lh.C0:Lerp(lhc0 * cf(0,-llegdist,-(maxlegdist-llegdist)/3.5)*angles(-(maxlegdist-llegdist)/6.5,0,0),.1)
  527.         rutj.C0 = rutj.C0:Lerp(rutjc0*angles(0,0,-torot),.1)
  528.     elseif tvel <2 then
  529.         anim = "idle"
  530.         nec.C0 = nec.C0:Lerp(necc0,.1)
  531.         if not holdingtool then
  532.             rs.C0 = rs.C0:Lerp(rsc0 * cf(rtdist/1.75,0,rtdist/4.5) * angles(0,-rtdist/1.5,0),.1)
  533.         else
  534.             rs.C0 = rs.C0:Lerp(rsc0 * cf(0,0,0) * angles(rad(90),0,0),.1)
  535.         end
  536.         ls.C0 = ls.C0:Lerp(lsc0 * cf(-ltdist/1.75,0,ltdist/4.5) * angles(0,ltdist/1.5,0),.1)
  537.         rh.C0 = rh.C0:Lerp(rhc0 * cf(0,-rlegdist,-(maxlegdist-rlegdist)/3.5)*angles(-(maxlegdist-rlegdist)/6.5,0,-torot),.1)
  538.         lh.C0 = lh.C0:Lerp(lhc0 * cf(0,-llegdist,-(maxlegdist-llegdist)/3.5)*angles(-(maxlegdist-llegdist)/6.5,0,-torot),.1)
  539.         rutj.C0 = rutj.C0:Lerp(rutjc0*angles(0,0,-torot),.1)
  540.     end
  541.     end
  542. swait()
  543. end
  544. end)
  545. anims()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement