In the game I am working on I want players to be prevented from moving around the map. I have been searching the web for some scripts but all of the scripts I tried did't work. I don't think this is very important but I want the character to stay on a seat. To make my life easier please tell me what script I should put it in. (e.g. LocalScript, Script)
COMMUNITY QUESTION
How do I prevent players from moving?
2 answers
local PlayerModule = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule"))
local Controls = PlayerModule:GetControls()
Controls:Disable() -- To Disable Controls
Controls:Enable() -- To Enable Controls
The above code is how you can Disable or Enable player controls, obviously this is client. You'll want to detect when a player sits down however you handle that and then run the Disable line, and then when they get up you'll want to run the Enable line.
If you want to stop a player from being able to leave a seat, then you will want to stop them from being able to jump.
Here is a server script (normal script) inside the seat you can use to achieve that:
--This first lines says what to do if someone touches the seat.
script.Parent.Touched:Connect(function(hit)
--It finds the player from the touched persons parents humanoid.
local human = hit.Parent:findFirstChild("Humanoid")
--If there is a player sitting down
if (human ~= nil ) then
--Set their jump speed to 0
hit.Parent.Humanoid.JumpPower = 0
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Use a server script, i cant tell much more
wait, how, would, you, just, make, the, player, won't, move, get, out, of, the, seat? i bet you need to use an exit gui button
I haven't tried it myself but you can set PlatformStand in the humanoid to True to lock them in place.