Im making a hotel room board and it will check if the user has left or has been respawned and idk how to check for that.
The humanoid has its own function that runs when the player (humanoid) dies.
Checking if the humanoid died with a local script
local player = game:GetService("Players").LocalPlayer local humanoid = player:WaitForChild("Humanoid") humanoid.Died:Connect(function() --Do stuff end)
Checking if the humanoid died with a script
--This script is parented to ServerScriptService game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) local humanoid = character:WaitForChild("Humanoid") if humanoid then humanoid.Died:Connect(function() --Do stuff end) end end) end)
Define all the players in a local script. Then do a DiedFunction, then make a Frame visible. Thats pretty much it Not going to give script.
game:GetService('Players').PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Character) print('Character has been respawned.') Character.Humanoid.Died:connect(function() print('Character has been killed.') end) end) end)