Advertisement
epicodascripter

Untitled

Feb 22nd, 2015
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. local lp = game.Players.LocalPlayer
  2. local chr = lp.Character
  3. local mouse = lp:GetMouse()
  4. function lerp(a,b,c)return a+(b-a)*c end
  5. function lerp2(a,b,c)return a*(1-c)+b*c end
  6. function clerp(c1,c2,al,x) --Smooth Animation!
  7. local com1 = {c1.X,c1.Y,c1.Z,c1:toEulerAnglesXYZ()}local com2 = {c2.X,c2.Y,c2.Z,c2:toEulerAnglesXYZ()}
  8. for i,v in pairs(com1) do if x == true then com1[i] = lerp2(v,com2[i],al) else com1[i] = lerp(v,com2[i],al)end end
  9. return CFrame.new(com1[1],com1[2],com1[3]) * CFrame.Angles(select(4,unpack(com1)))
  10. end
  11. local neck,rootjoint,rs,ls,rh,lh = chr.Torso['Neck'],chr.HumanoidRootPart['RootJoint'],chr.Torso['Right Shoulder'],chr.Torso['Left Shoulder'],chr.Torso['Right Hip'],chr.Torso['Left Hip']
  12. chr.Humanoid.Animator:Destroy()
  13. while wait() do
  14. if Vector3.new(chr.Torso.Velocity.x, 0, chr.Torso.Velocity.z).magnitude > 2 then
  15. rs.C0=clerp(rs.C0,CFrame.new(1,.5,0)*CFrame.Angles(math.sin(1)*.5,math.rad(90),0),.5)
  16. ls.C0=clerp(ls.C0,CFrame.new(-1,.5,0)*CFrame.Angles(math.sin(1)*-.5,math.rad(90),0),.5)
  17. end
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement