Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.90 KB | None | 0 0
  1.  
  2. local plr=game.Players.LocalPlayer
  3. local char=plr.Character
  4. local mouse=plr:GetMouse()
  5. local run=false
  6. local speed=0.1
  7. local snaptime=0.5
  8. local length=15
  9. local walking=false
  10. local Character=char
  11. local idle=true
  12.  
  13.  
  14.  
  15. local Torso = char:WaitForChild("Torso")
  16. local RootPart=char:WaitForChild("HumanoidRootPart")
  17. local LArm = char:WaitForChild("Left Arm")
  18. local RArm = char:WaitForChild("Right Arm")
  19. local LLeg = char:WaitForChild("Left Leg")
  20. local RLeg = char:WaitForChild("Right Leg")
  21. local Head = char:WaitForChild("Head")
  22.  
  23. local LAWeld = Instance.new("Weld",LArm)
  24. LAWeld.Part0 = LArm
  25. LAWeld.Part1 = Torso
  26. LAWeld.C0 = CFrame.new(1.5,0,0)
  27. local DefaultLA=CFrame.new(1.5,0,0)
  28.  
  29. local RAWeld = Instance.new("Weld",RArm)
  30. RAWeld.Part0 = RArm
  31. RAWeld.Part1 = Torso
  32. RAWeld.C0 = CFrame.new(-1.5,0,0)
  33. local DefaultRA=CFrame.new(-1.5,0,0)
  34.  
  35. local LLWeld = Instance.new("Weld",LLeg)
  36. LLWeld.Part0 = LLeg
  37. LLWeld.Part1 = Torso
  38. LLWeld.C0 = CFrame.new(.5,2,0)
  39. local DefaultLL=CFrame.new(.5,2,0)
  40.  
  41. local RLWeld = Instance.new("Weld",RLeg)
  42. RLWeld.Part0 = RLeg
  43. RLWeld.Part1 = Torso
  44. RLWeld.C0 =CFrame.new(-.5,2,0)
  45. local DefaultRL=CFrame.new(-.5,2,0)
  46.  
  47. local NWeld = Instance.new("Weld",Head)
  48. NWeld.Part0 = Head
  49. NWeld.Part1 = Torso
  50. NWeld.C0 = CFrame.new(0,-1.5,0)
  51. local DefaultN=CFrame.new(0,-1.5,0)
  52.  
  53. local TWeld = Instance.new("Weld",Torso)
  54. TWeld.Part0 = Torso
  55. TWeld.Part1 = RootPart
  56. TWeld.C0 = CFrame.new(0,0,0)
  57. local DefaultT=CFrame.new(0,0,0)
  58.  
  59. local LeftHip=char.Torso:WaitForChild("Left Hip")
  60. local LeftShoulder=char.Torso:WaitForChild("Left Shoulder")
  61. local RightHip=char.Torso:WaitForChild("Right Hip")
  62. local RightShoulder=char.Torso:WaitForChild("Right Shoulder")
  63. local Neck=char.Torso:WaitForChild("Neck")
  64. local RootJoin=RootPart:WaitForChild("RootJoint")
  65. local limbs={LLeg,LArm,RLeg,RArm,Torso}
  66. local OrigWelds={LeftHip,LeftShoulder,RightHip,RightShoulder,RootJoin}
  67. local LeftHipc=LeftHip:clone()
  68. local LeftShoulderc=LeftShoulder:clone()
  69. local RightHipc=RightHip:clone()
  70. local RightShoulderc=RightShoulder:clone()
  71. local RootJoinc=RootPart:WaitForChild("RootJoint"):clone()
  72. local Neckc=Neck:clone()
  73. local clones={LeftHipc,LeftShoulderc,RightHipc,RightShoulderc,RootJoinc}
  74.  
  75. function Deactivate()
  76. for i,v in pairs(OrigWelds) do
  77. v:Destroy()
  78. end
  79. end
  80.  
  81. Deactivate()
  82.  
  83. function Activate()
  84. for i,v in pairs(clones) do
  85. if v.Name~="RootJoint" then
  86. v.Parent=char.Torso
  87. v.Part1=limbs[i]
  88. else
  89. v.Parent=RootPart
  90. v.Part1=Torso
  91. end
  92. end
  93. end
  94.  
  95. local LAAI={CFrame.new(1.47054291, 0.295805931, 0, 0.980362475, -0.197203964, 0, 0.197203964, 0.980362475, 0, 0, 0, 1),
  96.  
  97. CFrame.new(1.58911896, 0.455195427, 0, 0.942918897, -0.333022594, 0, 0.333022594, 0.942918897, 0, 0, 0, 1) }
  98.  
  99. local LLAI={CFrame.new(0.366447449, 2.05275655, 0, 0.993932962, -0.109987587, 0, 0.109987579, 0.993932962, 0, 0, 0, 1) }
  100.  
  101. local RAAI={CFrame.new(-1.50102997, 0.301249504, 0.0222530365, 0.966990292, 0.254323632, 0.015791649, -0.254436553, 0.967073381, 0.00557740033, -0.0138532184, -0.00941126421, 0.99985975),
  102.  
  103. CFrame.new(-1.61062241, 0.577659607, 0.0222816467, 0.921636164, 0.38770771, 0.0164184049, -0.387807906, 0.921734393, 0.003302817, -0.0138528794, -0.00941118132, 0.99985975)}
  104.  
  105. RLAI={CFrame.new(-0.442806244, 2.05268383, 0, 0.995276213, 0.0970840752, 0, -0.0970840752, 0.995276213, 0, 0, 0, 1) }
  106.  
  107. local NLAI={CFrame.new(0, -1.49245977, -0.158288956, 1, 0, 0, 0, 0.99035722, -0.13853769, 0, 0.13853769, 0.99035722),
  108.  
  109. CFrame.new(0, -1.46035576, -0.346199036, 1, 0, 0, 0, 0.964806914, -0.262959272, 0, 0.262959272, 0.964806914) }
  110.  
  111. local TAI={CFrame.new(0,-10-math.cos(tick()),0)}
  112.  
  113. IdleAnims={LAAI,LLAI,RAAI,RLAI,NLAI,TAI}
  114.  
  115.  
  116.  
  117. welds={LAWeld,LLWeld,RAWeld,RLWeld,NWeld,TWeld}
  118. Defaults={LAAI[1],LLAI[1],RAAI[1],RLAI[1],NLAI[1],TAI[1]}
  119. OrigDefaults={DefaultLA,DefaultLL,DefaultRA,DefaultRL,DefaultN,DefaultT}
  120. local LAT=nil
  121. local LLT=nil
  122. local RAT=nil
  123. local RLT=nil
  124. local TT=nil
  125. local NT=nil
  126.  
  127. local LATI=nil
  128. local LLTI=nil
  129. local RATI=nil
  130. local RLTI=nil
  131. local TTI=nil
  132. local NTI=nil
  133.  
  134. PosWalk={LAT,LLT,RAT,RLT,NT,TT}
  135.  
  136.  
  137. PosIdle={LATI,LLTI,RATI,RLTI,NTI,TTI}
  138.  
  139.  
  140.  
  141. local LAA={CFrame.new(1.25498962, 1.55565453, -0.0322542191, 0.976632535, 0.214844614, 0.00554542337, 0.21491617, -0.976307333, -0.0252000056, -4.80024411e-008, 0.0258029457, -0.999667048)}
  142.  
  143. local LLA={CFrame.new(0.279708862, 2.12116861, 0, 0.973199666, -0.22996217, 0, 0.22996217, 0.973199666, 0, 0, 0, 1)}
  144.  
  145. local RAA={CFrame.new(-1.27351761, 1.68028164, 0.020203352, 0.966919124, -0.255052239, 0.00396421505, -0.255083054, -0.966802418, 0.0150269, -3.18337925e-008, -0.0155410012, -0.999879241)}
  146.  
  147. local RLA={CFrame.new(-0.359859467, 2.15520191, 0, 0.969144285, 0.246494561, 0, -0.246494561, 0.969144285, 0, 0, 0, 1)}
  148.  
  149. local NLA={CFrame.new(0, -0.831441164, 1.24848127, 1, 0, 0, 0, 0.554294109, 0.832320929, 0, -0.832320929, 0.554294109)}
  150.  
  151. local TA={
  152. CFrame.new(0, 0, -3.28998947, 1, 0, 0, 0, 0, -1, 0, 1, 0)}
  153.  
  154. WalkAnims={LAA,LLA,RAA,RLA,NLA,TA}
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163. spawn(function()
  164. while true do
  165. wait(2)
  166. for i,v in ipairs(IdleAnims) do
  167. spawn(function()
  168. for b,z in pairs(v) do
  169. PosIdle[i]=z
  170. wait(1)
  171. end
  172. end)
  173. end
  174. end
  175. end)
  176.  
  177. spawn(function()
  178. while true do
  179. wait(snaptime*#RLA)
  180. for i,v in ipairs(WalkAnims) do
  181. spawn(function()
  182. for b,z in pairs(v) do
  183. PosWalk[i]=z
  184. wait(snaptime)
  185. end
  186. end)
  187. end
  188. end
  189. end)
  190.  
  191.  
  192.  
  193. repeat wait(1) until PosIdle[1]~=nil or PosWalk[1]~=nil
  194.  
  195. print("Ready")
  196.  
  197. --check if walking
  198.  
  199. game:GetService("RunService").RenderStepped:connect(function()
  200. if char.Torso.Velocity.Magnitude>=10 then
  201. print("Moving")
  202. walking=true
  203. for i,v in pairs(welds) do
  204. if v==TWeld then
  205. v.C0=v.C0:lerp(PosWalk[i]*CFrame.new(math.sin(tick()),math.sin(tick()),0),0.1)
  206. end
  207. v.C0=v.C0:lerp(PosWalk[i],0.1)
  208. end
  209. elseif char.Torso.Velocity.Magnitude<=30 then
  210.  
  211.  
  212.  
  213. walking=false
  214.  
  215. for i,v in pairs(welds) do
  216. if v==TWeld then
  217. v.C0=v.C0:lerp(CFrame.new(0,-5-math.cos(tick()),0),0.05)
  218. end
  219. v.C0=v.C0:lerp(PosIdle[i],0.01)
  220. end
  221. end
  222.  
  223. end)
  224.  
  225.  
  226.  
  227.  
  228. --walk func
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement