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

How Do I Fix This WalkSpeed Problem?[Closed]

Asked by
tanzane 100
9 years ago

I was messing with the walkspeed and when I did this script, which I looked in the Roblox Wiki. (Part of it)

game.Players.tanzane.Character.Humanoid.WalkSpeed = 60

When I tested it out in studio it worked, but when I enter my game through the roblox website and clicked play. My walkspeed is normal. Is there a different script I should do?

(This is all in a Local Script)

0
You may have to add some type of wait, or you may have to to try it in a regular script. RedCombee 585 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

What I did is completely rewrite the script so it changes EVERYONE's WalkSpeed if you would like it to be just yours you would have to play around with it. Also with your current one you never added a loop or anything like that so it would be used once and never be used again, or possibly even never be used. Also here is some information on Local Scripts you could learn from that source when and when not to use a Local Script

Put this in a NORMAL Script!

playerspeed = 60
gw = game.Workspace

while true do
wait(5)
local list = game.Players:getChildren()
for i = 1, #list do
    local player = gw:findFirstChild(list[i].Name)
    if player ~= nil then
        hum = player:findFirstChild("Humanoid")
        if hum ~= nil then
            hum.WalkSpeed = playerspeed
        end
    end
end
end

If this answered your Question, Please remember to Submit as Answer!

0
It worked, thanks. ^-^ tanzane 100 — 9y
0
Do you mind clicking Answer on my post since it worked? Thanks :) It gives me reputation and helps me in the future ggggyourface23 63 — 9y
1
Whoever Downvoted me is another Random Downvoter.... I am not begging for rep. When someone answers your question your supposed to click Accept as Answer ggggyourface23 63 — 9y
0
Never use while true do.. Thats why. Nickoakz 231 — 9y
Ad
Log in to vote
3
Answered by 9 years ago

The script is trying to change your characters WalkSpeed before your character loads.

The simplest thing you could do is use the CharacterAdded event

game.Players.PlayerAdded:connect(function(player) --this runs every time a player joins the game
    if player.Name == "tanzane" then --this checks if the player's name is tanzane
        player.CharacterAdded:connect(function(char) --this runs every time your character respawns
            local humanoid = char:WaitForChild("Humanoid") -- this waits for the character's humanoid to load
            humanoid.WalkSpeed = 60 -- this changes the humanoid's walkspeed
        end)
    end
end)

Answer this question