Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can i put a limit on walkspeed?

Hi! Here is the script and I want to put a limit about 250 speed. So listen to me. I need after the player reach 250 walkspeed he can gain other speed. How do you do that? Please help!

while wait(.5) do
	local children = game.Players:GetChildren()
	for i = 1, #children do
		if children[i].Character ~= nil then
		local hum = children[i].Character.Humanoid
		hum.WalkSpeed = children[i].leaderstats.Speed.Value/20 + 0.2
		end
	end
end

1 comment

0

What exactly are you trying to do...?

1 answer

✓ Accepted answer

Try creating a local script in StarterPlayerScripts.

local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()

repeat 
	wait() 
until Character:FindFirstChild("Humanoid")
local Humanoid = Character.Humanoid

while wait() do -- Set wait to any value
	if Humanoid.WalkSpeed >= 250 then
		Humanoid.WalkSpeed = 250
	end
end

I tested this and it worked for me, if you have any questions, ask and I'll answer to the best of my ability (I'm not very skilled, but I know a lot).

This discussion is preserved as it was. New answers, comments, and votes are closed.