I know this is a bit of a long shot but I'm making a script that forces characters to walk on a path through different bookmark points. When this block gets hit by a player, it moves that player to the next part. How would I get it so that it stops the player from being able to control their character? Thanks!
function touched(part) if part.Name == "Head" then local player = game.Players:GetPlayerFromCharacter(part.Parent) player.Character.Humanoid:MoveTo(script.Parent.Parent.Part1.Position) end end script.Parent.Touched:connect(touched)
Each player has a script named ControlScript
which allows each player to use a input device such as KeyBoard, GamePad, etc to move there character. Note this is just the default one and can be overwritten if the developer of the game does so. So as long as you don't write a new one this will work. ControlScript
is a child of PlayerScripts
which is a child of player
. So we just simply have to disable the script to not let them move. You will have to enable it again to allow them to move their character.
function touched(part) if part.Name == "Head" then local player = game.Players:GetPlayerFromCharacter(part.Parent) player.PlayerScripts.ControlScript.Disabled = true player.Character.Humanoid:MoveTo(script.Parent.Parent.Part1.Position) end end script.Parent.Touched:connect(touched)