I’m making a custom health script, and I have a loop constantly running that manages a gui for the health bar. When the loop detects the players health value as 0 it kills them, then sets the value back to its maximum.
My problem is that I want the health to be reset when the player respawns instead of right after dying, and I don’t know how to make the script wait until that happens.
while true do if Player.Health.Value > 0 then --Scale the health bar gui to the health value else Player.Character:BreakJoints() --Something to delay until the player respawns Player.Health.Value = 100 end wait() end
What would I do to delay the script for the same time as the players respawn? Using something like wait() would be inconsistent with lag.