This may be a simple solution for some of you guys but I can’t seem to figure it out. All I want to check is if the player has died during the time frame of the wait.
What I could do is character.Humanoid.Died before the wait and set a variable that the char has died but I thought there used to be a simpler solution like the one below.
local function PlayerPressedE(Player)
local Character = Player.Character
wait(20)
if Character then
--do stuff
else
print("Player died during the wait")
end
end
Destroys don’t actually release references (and thus, memory), only remove/lock the object along with disconnecting events. Not even sure if characters are deleted, at a time they weren’t.
Yeah makes sense now and also here is the new code if anyone wants it
local function PlayerPressedE(Player)
local Character = Player.Character
wait(20)
if Character.Humanoid.Health ~= 0 then
--do stuff
else
print("Player died during the wait")
end
end