How can I make this Gui visibility false when the timer ends. As it goes false in the middle But I want it to wait until the timer finishes.
local Player = game.Players.LocalPlayer
local char = Player.Character
local Humanoid = char:WaitForChild("Humanoid")
Player.PlayerGui:FindFirstChild("DeathGui"):WaitForChild("Frame").Visible = true
for i = 5, 0, -1 do
Player.PlayerGui:FindFirstChild("DeathGui").Frame.RespawnTimer.Text = "Respawning in "..i
Player.PlayerGui:FindFirstChild("DeathGui"):WaitForChild("Frame").Visible = false
I think that is because you are waiting five seconds for it to go away. By the time you respawn, that script might go ahead and turn it to false (so say you reset, you wait five seconds for the countdown, respawn, and then reset again, but while the counter goes down, the GUI will turn invisible because of the previous task). Definitely not explaining it well, but I recommend you declare that you make the GUI ResetOnRespawn and put the script under the GUI itself. Not sure what else to recommend here.