I know you can manipulate a humanoids walkspeed so you slow down, but I’d like to know if there are other ways to slow players down so you can keep the speed you want, but sometimes stop the player from moving too fast.
I know BodyPosition works, but it could be a bit annoying to work with. Anything else you can use that may give a better result?
Well, you can save the default walkspeed in a variable or any other way, change the walkspeed to slow the player down, then change back to the original walkspeed to reset the player speed.
I’m confused what you’re trying to achieve here? Do you want to manipulate the player into thinking they’re walking slower? If so, you could get a walking animation, and then slow it down along with Humanoids walkspeed.
You can use the magnitude property of HumanoidRootPart.Velocity to determine how fast they’re moving in any direction, and if it’s above your defined limit, reduce it. Example:
local rootPart = path.to.character.HumanoidRootPart
local walkSpeed = path.to.character.Humanoid.WalkSpeed
game:GetService("RunService").Heartbeat:Connect(function()
if (rootPart.Velocity.magnitude > walkSpeed) then
rootPart.Velocity = rootPart.Velocity / (rootPart.Velocity.magnitude/maxSpeed)
end
end)
This snippet would scale the character’s velocity down so it never goes faster than the speed you set.