How do you lock player movement until a play button is clicked?

Hey, kinda a bad scripter so could someone help me? Basically what I’d like to achieve is player movement locked until play is clicked?

Change their walkspeed to 0.

1 Like

Use ContextActionService to lock player movement.

2 Likes

On my opinion, that way is better for new scripters or lazy scripters (Me), so it can work. Here’s a code I made to do such:

Begin of LocalScript, on Workspace
game.StarterPlayer.CharacterWalkspeed = 0
game.StarterPlayer.CharacterJumpBoost = 0
End of LocalScript

Begin of LocalScript, child of Play Button
script.Parent.MouseClick:connect(function(onClick)
game.StarterPlayer.CharacterWalkspeed = 16 (*)
game.StarterPlayer.CharacterJumpBoost = 50 (**)
end
End of LocalScript
*You can do any value, but I used the default value.
** Again, any value is possible, but I use the default one.

If you look on the code, I also make it so the player cannot jump. Otherwise you could technically do something that concludes player movement.

EDIT: If you don’t want to have a Play button, then instead of making a LocalScript child of a Play Button, just put it below StarterGui, and remove the first and last line. It’ll make it so it directly stops player movement.

1 Like