Player Controls can't be re-enabled

So a straightforward issue. I tweaked the respawn button so that the player needs to wait 5 seconds before respawning. I also disabled their movement until they respawn. The issue is that the player still can’t move even though I re-enabled controls.

Script

local bindableEvent = Instance.new("BindableEvent")
local respawnEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvents").Respawn
local controls = require(game:GetService("Players").LocalPlayer.PlayerScripts.PlayerModule):GetControls()

bindableEvent.Event:Connect(function()
	local waitTime = 5
	controls:Disable()
	while true do
		print("Respawning in ".. waitTime .. " seconds...")
		waitTime -= 1
		if waitTime <= 0 then
			task.wait(1)
			controls:Enable(true)
			respawnEvent:FireServer()
			break
		else
			task.wait(1)
		end
	end
end)
game:GetService("StarterGui"):SetCore("ResetButtonCallback", bindableEvent)

I’m probably missing the issue here. Anyone have an idea?

Could you put a print statement after this and see if it shows up? I assume it would, but just checking

If you want them to wait 5s before respawning why not use:

game.Players.RespawnTime = 5

Also I’ve never used SetCore before but looking at the string, it probably expects a callback and not a bindable event but idk, I need to look into that.

I mean the idea works, and I was hoping to incorporate more than just the respawn time (i.e. UI above the player that countdowns the time left until respawning, ability to freeze the player, etc). I wanted to do it all once the reset button was pressed- so I’m not sure RespawnTime would help me in this case. But thanks for the suggestion.

1 Like

Solved the issue by just anchoring the character instead of using the player control module. Works better.