Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would you set player walkspeed to 0?

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

✓ Accepted answer

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)

2 comments

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.

0

Did it out of habbit.

This discussion is preserved as it was. New answers, comments, and votes are closed.