Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local forwardvec = math.clamp((Torso.Velocity*Torso.CFrame.lookVector).X+(Torso.Velocity*Torso.CFrame.lookVector).Z,-Humanoid.WalkSpeed,Humanoid.WalkSpeed)
- local sidevec = math.clamp((Torso.Velocity*Torso.CFrame.rightVector).X+(Torso.Velocity*Torso.CFrame.rightVector).Z,-Humanoid.WalkSpeed,Humanoid.WalkSpeed)
- local sidevelocity = sidevec/Humanoid.WalkSpeed
- local forwardvelocity = forwardvec/Humanoid.WalkSpeed
- if -RootPart.Velocity.Y / 1.5 > -5 and -RootPart.Velocity.Y / 1.5 < 150 then
- velocityYFall = RootPart.Velocity.Y / 1.5
- elseif -RootPart.Velocity.Y / 1.5 < -5 then
- velocityYFall = 5
- elseif -RootPart.Velocity.Y / 1.5 > 150 then
- velocityYFall = -150
- end
- if -RootPart.Velocity.Y / 180 > 0 and -RootPart.Velocity.Y / 180 < 1.2 then
- velocityYFall2 = RootPart.Velocity.Y / 180
- elseif -RootPart.Velocity.Y / 180 < 0 then
- velocityYFall2 = 0
- elseif -RootPart.Velocity.Y / 180 > 1.2 then
- velocityYFall2 = -1.2
- end
- if -RootPart.Velocity.Y / 1.5 > -5 and -RootPart.Velocity.Y / 1.5 < 50 then
- velocityYFall3 = RootPart.Velocity.Y / 1.5
- elseif -RootPart.Velocity.Y / 1.5 < -5 then
- velocityYFall3 = 5
- elseif -RootPart.Velocity.Y / 1.5 > 50 then
- velocityYFall3 = -50
- end
- if -RootPart.Velocity.Y / 1.5 > -50 and -RootPart.Velocity.Y / 1.5 < 20 then
- velocityYFall4 = RootPart.Velocity.Y / 1.5
- elseif -5 > -RootPart.Velocity.Y / 180 then
- velocityYFall4 = 5
- elseif -RootPart.Velocity.Y / 180 > 50 then
- velocityYFall4 = -50
- end
- if RootPart.RotVelocity.Y / 6 < 1 and RootPart.RotVelocity.Y / 6 > -1 then
- neckrotY = RootPart.RotVelocity.Y / 6
- elseif RootPart.RotVelocity.Y / 6 < -1 then
- neckrotY = -1
- elseif RootPart.RotVelocity.Y / 6 > 1 then
- neckrotY = 1
- end
- if RootPart.RotVelocity.Y / 8 < 0.6 and RootPart.RotVelocity.Y / 8 > -0.6 then
- neckrotY2 = RootPart.RotVelocity.Y / 8
- elseif RootPart.RotVelocity.Y / 8 < -0.6 then
- neckrotY2 = -0.6
- elseif RootPart.RotVelocity.Y / 8 > 0.6 then
- neckrotY2 = 0.6
- end
- if RootPart.RotVelocity.Y / 6 < 0.2 and RootPart.RotVelocity.Y / 6 > -0.2 then
- torsorotY = RootPart.RotVelocity.Y / 6
- elseif RootPart.RotVelocity.Y / 6 < -0.2 then
- torsorotY = -0.2
- elseif RootPart.RotVelocity.Y / 6 > 0.2 then
- torsorotY = 0.2
- end
- if RootPart.RotVelocity.Y / 8 < 0.2 and RootPart.RotVelocity.Y / 8 > -0.2 then
- torsorotY2 = RootPart.RotVelocity.Y / 8
- elseif RootPart.RotVelocity.Y / 8 < -0.2 then
- torsorotY2 = -0.2
- elseif RootPart.RotVelocity.Y / 8 > 0.2 then
- torsorotY2 = 0.2
- end
- torsoY = -(Torso.Velocity * Vector3.new(1, 0, 1)).magnitude / 20
- torsoY2 = -(Torso.Velocity * Vector3.new(1, 0, 1)).magnitude / 36
- local rightvector = (RootPart.Velocity * RootPart.CFrame.rightVector).X + (RootPart.Velocity * RootPart.CFrame.rightVector).Z
- local lookvector = (RootPart.Velocity * RootPart.CFrame.lookVector).X + (RootPart.Velocity * RootPart.CFrame.lookVector).Z
- if lookvector > Humanoid.WalkSpeed then
- lookvector = Humanoid.WalkSpeed
- end
- if lookvector < -Humanoid.WalkSpeed then
- lookvector = -Humanoid.WalkSpeed
- end
- if rightvector > Humanoid.WalkSpeed then
- rightvector = Humanoid.WalkSpeed
- end
- if rightvector < -Humanoid.WalkSpeed then
- rightvector = -Humanoid.WalkSpeed
- end
- local lookvel = lookvector / Humanoid.WalkSpeed
- local rightvel = rightvector / Humanoid.WalkSpeed
- local leftlegheight,rightlegheight = 0,0
- local Rray,Lray = Ray.new(RightLeg.Position,RightLeg.CFrame.UpVector.Unit*-2),Ray.new(LeftLeg.Position,LeftLeg.CFrame.UpVector.Unit*-2)
- local rp,Rpos = workspace:FindPartOnRayWithIgnoreList(Rray,{Character},false,true)
- local lp,Lpos = workspace:FindPartOnRayWithIgnoreList(Lray,{Character},false,true)
- leftlegheight,rightlegheight = 0,0
- if rp then rightlegheight = (RightLeg.Position-Rpos).Magnitude-.95 end
- if lp then leftlegheight = (LeftLeg.Position-Lpos).Magnitude-.95 end
Advertisement
Add Comment
Please, Sign In to add comment