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

How do i make an OnEnter walkspeed script?

Asked by 10 years ago

I need an OnEnter walkspeed script since when you join my game your speed for some reason is 32 instead of 16...

2
You probably have another script changing the walkspeed. Just look through your game's scripts and fix the one causing it. 2eggnog 981 — 10y

1 answer

Log in to vote
1
Answered by
2eggnog 981 Moderation Voter
10 years ago

Here's how you would normally do it..

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        local hum = character:WaitForChild("Humanoid")
        hum.WalkSpeed = 16
    end)
end)

But in your case, since something else is changing the walkspeed, you might want to wait before changing it, like this.

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        wait(.1)
        local hum = character:WaitForChild("Humanoid")
        hum.WalkSpeed = 16
    end)
end)

Again, you should probably fix the thing causing it. I just posted this in case other people want to see it.

Ad

Answer this question