I am trying to disable and enable player’s input so that they cannot move/jump.
I am aware of setting JumpPower and WalkSpeed to 0, but the player is being moved via scripts.
Player touches npc, triggers cut scene and disables controls.
1 | RunService:UnbindFromRenderStep( "ControlScriptRenderstep" ) |
Player then battles npc and either wins or dies.
If it wins it will run the code,
1 | RunService:BindToRenderStep( "ControlScriptRenderstep" , Enum.RenderPriority.Input.Value, function (dt) Controls:OnRenderStepped(dt) end ) |
and then the player can move again. However, when it dies it will run the same code, however the player cannot move.
I have tried running an event right when the player’s health is set to 0, I’ve tried
01 | game.Players.PlayerAdded:Connect( function (player) |
03 | player.CharacterAdded:Connect( function (character) |
05 | character:WaitForChild( "Humanoid" ).Died:Connect( function () |
07 | repeat wait() until player.Character |
09 | game.ReplicatedStorage.Remotes.CharDiedRemote:FireClient(player) |
and then in a local script
1 | local function CharDied() |
5 | RunService:BindToRenderStep( "ControlScriptRenderstep" , Enum.RenderPriority.Input.Value, function (dt) Controls:OnRenderStepped(dt) end ) |
9 | game.ReplicatedStorage.Remotes.CharDiedRemote.OnClientEvent:Connect(CharDied) |
It prints both died and respawned, but still doesn’t allow player to move.
Is there a better way of doing this, or am I doing something incorrectly?