Is it possible to detect when a client uses their keyboard from a serverscript?
For context, I’m making a respawn system and need to detect keyboard input to respawn the player. If this is not possible, how can I go about doing the above?
Current Code:
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local humanoid = char:WaitForChild("Humanoid")
local canSpawn = false
humanoid.Died:Connect(function()
plr.PlayerGui:WaitForChild("DeathGui"):WaitForChild("deathFrame").Visible = true
for i = 30, 0, -1 do
plr.PlayerGui:WaitForChild("DeathGui"):WaitForChild("deathFrame"):WaitForChild("timer").Text = "You can respawn in "..i
wait(1)
if i == 0 then
local canSpawn = true
plr.PlayerGui:WaitForChild("DeathGui"):WaitForChild("deathFrame"):WaitForChild("timer").Text = "Press any key to respawn"
--THIS IS WHERE I WANT TO DETECT USER INPUT FROM A SERVER SCRIPT
break
end
end
end)
end)
end)