When I disable a players controls, it works fine. But when I respawn, for some reason, I am stuck, disabled

  1. What do you want to achieve?
    I want to fix the bug where when I respawn, my controls (cant move at all) don’t work.

  2. What is the issue?
    When I use

-- Local Script
local Controls = require(player.PlayerScripts:WaitForChild("PlayerModule")):GetControls()
Controls:Disable()
Controls:Enable()

It works fine, but when I respawn, my controls are disabled for some reason. It works perfectly fine before respawning though. Also, sometimes, when I respawn, I walk in one direction and I can’t stop it.

  1. What solutions have you tried so far?
    I have tried putting a Controls:Enable() part before respawning, but it seems it does not work. Also, for some reason, when some other player attacks the stuck player, it un-stucks them as the attack uses Controls:Disable() then it waits then uses Controls:Enable().
2 Likes

So does this not work?

game.Players.PlayerAdded:Connect(function(p)
p.CharacterAdded:Connect(function(char)
local Controls = require(player.PlayerScripts:WaitForChild("PlayerModule")):GetControls()
Controls:Enable()
end)
end)

I even tried that but still stuck when respawining

player.CharacterAdded:Connect(function()
	Controls:Enable()--enable controls
end)

I found out the solution! To fix my problem, I just placed the local script in StarterPlayerScripts instead of StarterCharacterScripts. It fixed my problem since when it was in StarterCharacterScripts it would break every time I respawned because it would reset if the character reseted. I finally solved the problem I had for weeks, and if anyone else comes into this problem just check if its placed in its correct parent, StarterPlayerScripts.

5 Likes

Hello I have come across the same problem. For my situation I have already correctly placed my script inside StarterPlayerScripts but the problem is whenever I try to set the player controls to Enable() when the humanoid died or when the player respawns it’s stuck too. If I never disable the controls in my script the issue won’t happen. If there’s anyway to fix that I would really appreciate it. In the meantime I’ll try to find another way to prevent the player from walking during the specific time in my script.

I’m sorry for being very late, but are you using :Disable()? and can I see your code

Yes I was using Disable() method. I solved the problem, I need to initiate the controls by disabling it once and enabling them right after to be able to make the switch and toggle them freely during the game runtime.

1 Like