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

How would you set player walkspeed to 0?

Asked by
steev 0
10 years ago

For example: When the player joins they go through a NoCollide brick that sets their walkspeed to 0 (which means they cannot move).

How can you do this in Lua?

1 answer

Log in to vote
4
Answered by
nate890 495 Moderation Voter
10 years ago

To change a players' walkspeed to 0, set the WalkSpeed property of their character's Humanoid to 0.

local part = script.Parent

part.Touched:connect(function(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    if player then
        player.Character.Humanoid.WalkSpeed = 0 -- set walkspeed
    end
end)
0
Using debounce in this situation would actually have a /negative/ side affect. There is no need for it and it will actually cause some players to not be set if multiple people walk on the part at the same time. The debounce should be removed. User#11893 186 — 10y
0
Did it out of habbit. nate890 495 — 10y
Ad

Answer this question