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?
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?
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)
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
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.
Did it out of habbit.