I have a walking script, but the player can interrupt that script if the player tries to move, I want to make it so the player can't control it's movement and NOT make it so it can't move.
The correct way to disable a user's controls is to go inside the players dev settings. You could go ahead and change the jumppower and walkspeed but that’d be temporary. Using the below script would be the most efficient way you can find.
SCRIPT(EXAMPLE CONTROL DISABLED ON SPAWN)
game:GetService('Players').PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function() plr.DevComputerMovementMode = 'Scriptable' --Turns off controls plr.DevTouchMovementMode = 'Scriptable' --Just in case the player is in a mobile device(You can use another function to find out the device type) print('Controls Off') end) wait(10) plr.DevComputerMovementMode = 'UserChoice' --Turns back on plr.DevTouchMovementMode = 'UserChoice' print('Back online') end)
I hope this answers your question. Pretty much what you need to play around with isDevComputerMovementMode. If you are using this along with the walk script, let’s say hit.Parent
is the player’s model, you have to then do local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
and then you can pretty much use the one from the script I have provided.
NOTE THIS QUESTION HAS BEEN ANSWERED PREVIOULSY FOR ANOTHER USER
Make sure to search for your issue and post questions only if they don’t exist.
There is a script in player.PlayerScripts thats called “ContolScript”.
Delete that script when a player is added.
There is a script in player.PlayerScripts thats called “ContolScript” how Nexian has said, copy this script and put in lighting, so create a OnTouch, OnClicked or OnEnter event that will delete this script, and when you want he move again, create a script that will clone this script in lighting to the player again
If you don't intend to let them move ever again then you can delete the script but if you do intend to do so instead of cloning it I would recommend just disabling it
there is a script under PlayerScripts called ControlScript, do something like this:
local plr = game.Players.LocalPlayer plr.PlayerScripts:WaitForChild("ControlScript").Disabled = true