Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can i put a limit on walkspeed?

Asked by 3 years ago

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

0
What exactly are you trying to do...? xXLegendGamerz16Xx 231 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

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).

Ad

Answer this question