Yea there is still a delay and the Gui stays up for too long, I put 10 seconds because it automatically resets when character respawns but now it actually stay up for 10 seconds…
Why are you even using wait for a death overlay? The default respawn time is 5 seconds and event-based programming is staring right at you, so you should be trying to use events to control the visibility state of your Gui (depending on if ResetOnSpawn is enabled or not).
If your Gui has ResetOnSpawn then you don’t need to control the visibility of the Gui yourself. If it does then your Died connection should only be making the death overlay visible and your CharacterAdded connection should be making it invisible.
There are some additional recommendations I’d like to make:
Please condense your posts. DevForum isn’t a real time chat channel. Posting multiple short posts is sort of spammy and bloats replies as well as the time to scroll through information. You can add extra related thoughts on to a previous post with an edit.
Debug first when something doesn’t work and try fixing the problem yourself rather than trying to get others to fix it every time it errors. If it does error and you can’t figure it out and need help, you can reply, but provide context. The console is available to report issues in testing modes and for red outlines you can hover over them to see what problem they’re reporting.
plrs.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
char:FindFirstChild("Humanoid").Died:Connect(function()
local pg = plr:WaitForChild("PlayerGui")
pg.DeathFrameGui.Frame.Visible = true
wait(10)
--Change the wait to how long you want it to stay up (in seconds)
pg.DeathFrameGui.Frame.Visible = false
end)
end)
end)