Parellel_X

a

Nov 15th, 2021
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.81 KB | None | 0 0
  1. local forwardvec = math.clamp((Torso.Velocity*Torso.CFrame.lookVector).X+(Torso.Velocity*Torso.CFrame.lookVector).Z,-Humanoid.WalkSpeed,Humanoid.WalkSpeed)
  2. local sidevec = math.clamp((Torso.Velocity*Torso.CFrame.rightVector).X+(Torso.Velocity*Torso.CFrame.rightVector).Z,-Humanoid.WalkSpeed,Humanoid.WalkSpeed)
  3. local sidevelocity = sidevec/Humanoid.WalkSpeed
  4. local forwardvelocity = forwardvec/Humanoid.WalkSpeed
  5. if -RootPart.Velocity.Y / 1.5 > -5 and -RootPart.Velocity.Y / 1.5 < 150 then
  6. velocityYFall = RootPart.Velocity.Y / 1.5
  7. elseif -RootPart.Velocity.Y / 1.5 < -5 then
  8. velocityYFall = 5
  9. elseif -RootPart.Velocity.Y / 1.5 > 150 then
  10. velocityYFall = -150
  11. end
  12. if -RootPart.Velocity.Y / 180 > 0 and -RootPart.Velocity.Y / 180 < 1.2 then
  13. velocityYFall2 = RootPart.Velocity.Y / 180
  14. elseif -RootPart.Velocity.Y / 180 < 0 then
  15. velocityYFall2 = 0
  16. elseif -RootPart.Velocity.Y / 180 > 1.2 then
  17. velocityYFall2 = -1.2
  18. end
  19. if -RootPart.Velocity.Y / 1.5 > -5 and -RootPart.Velocity.Y / 1.5 < 50 then
  20. velocityYFall3 = RootPart.Velocity.Y / 1.5
  21. elseif -RootPart.Velocity.Y / 1.5 < -5 then
  22. velocityYFall3 = 5
  23. elseif -RootPart.Velocity.Y / 1.5 > 50 then
  24. velocityYFall3 = -50
  25. end
  26. if -RootPart.Velocity.Y / 1.5 > -50 and -RootPart.Velocity.Y / 1.5 < 20 then
  27. velocityYFall4 = RootPart.Velocity.Y / 1.5
  28. elseif -5 > -RootPart.Velocity.Y / 180 then
  29. velocityYFall4 = 5
  30. elseif -RootPart.Velocity.Y / 180 > 50 then
  31. velocityYFall4 = -50
  32. end
  33. if RootPart.RotVelocity.Y / 6 < 1 and RootPart.RotVelocity.Y / 6 > -1 then
  34. neckrotY = RootPart.RotVelocity.Y / 6
  35. elseif RootPart.RotVelocity.Y / 6 < -1 then
  36. neckrotY = -1
  37. elseif RootPart.RotVelocity.Y / 6 > 1 then
  38. neckrotY = 1
  39. end
  40. if RootPart.RotVelocity.Y / 8 < 0.6 and RootPart.RotVelocity.Y / 8 > -0.6 then
  41. neckrotY2 = RootPart.RotVelocity.Y / 8
  42. elseif RootPart.RotVelocity.Y / 8 < -0.6 then
  43. neckrotY2 = -0.6
  44. elseif RootPart.RotVelocity.Y / 8 > 0.6 then
  45. neckrotY2 = 0.6
  46. end
  47. if RootPart.RotVelocity.Y / 6 < 0.2 and RootPart.RotVelocity.Y / 6 > -0.2 then
  48. torsorotY = RootPart.RotVelocity.Y / 6
  49. elseif RootPart.RotVelocity.Y / 6 < -0.2 then
  50. torsorotY = -0.2
  51. elseif RootPart.RotVelocity.Y / 6 > 0.2 then
  52. torsorotY = 0.2
  53. end
  54. if RootPart.RotVelocity.Y / 8 < 0.2 and RootPart.RotVelocity.Y / 8 > -0.2 then
  55. torsorotY2 = RootPart.RotVelocity.Y / 8
  56. elseif RootPart.RotVelocity.Y / 8 < -0.2 then
  57. torsorotY2 = -0.2
  58. elseif RootPart.RotVelocity.Y / 8 > 0.2 then
  59. torsorotY2 = 0.2
  60. end
  61. torsoY = -(Torso.Velocity * Vector3.new(1, 0, 1)).magnitude / 20
  62. torsoY2 = -(Torso.Velocity * Vector3.new(1, 0, 1)).magnitude / 36
  63. local rightvector = (RootPart.Velocity * RootPart.CFrame.rightVector).X + (RootPart.Velocity * RootPart.CFrame.rightVector).Z
  64. local lookvector = (RootPart.Velocity * RootPart.CFrame.lookVector).X + (RootPart.Velocity * RootPart.CFrame.lookVector).Z
  65. if lookvector > Humanoid.WalkSpeed then
  66. lookvector = Humanoid.WalkSpeed
  67. end
  68. if lookvector < -Humanoid.WalkSpeed then
  69. lookvector = -Humanoid.WalkSpeed
  70. end
  71. if rightvector > Humanoid.WalkSpeed then
  72. rightvector = Humanoid.WalkSpeed
  73. end
  74. if rightvector < -Humanoid.WalkSpeed then
  75. rightvector = -Humanoid.WalkSpeed
  76. end
  77. local lookvel = lookvector / Humanoid.WalkSpeed
  78. local rightvel = rightvector / Humanoid.WalkSpeed
  79. local leftlegheight,rightlegheight = 0,0
  80. local Rray,Lray = Ray.new(RightLeg.Position,RightLeg.CFrame.UpVector.Unit*-2),Ray.new(LeftLeg.Position,LeftLeg.CFrame.UpVector.Unit*-2)
  81. local rp,Rpos = workspace:FindPartOnRayWithIgnoreList(Rray,{Character},false,true)
  82. local lp,Lpos = workspace:FindPartOnRayWithIgnoreList(Lray,{Character},false,true)
  83. leftlegheight,rightlegheight = 0,0
  84. if rp then rightlegheight = (RightLeg.Position-Rpos).Magnitude-.95 end
  85. if lp then leftlegheight = (LeftLeg.Position-Lpos).Magnitude-.95 end
Advertisement
Add Comment
Please, Sign In to add comment