It's confusing to me.
While ATestAccount420's answer would probably work, I would recommend using the .Died event.
local player = game.Players.LocalPlayer repeat wait() until player.Character local hum = player.Character:WaitForChild("Humanoid") hum.Died:connect(function() -- insert whatever you want in here end)
This way, you are able to do other things in your script, without messing with spawn()
or coroutines.
You'd do something like this, ofc you could customize the gui to how u like it but yeah.
local plr = game.Players.LocalPlayer local dead = false while true do if plr.Character.Humanoid.Health == 0 and dead == false then local guithingyidk = Instance.new('ScreenGui', plr.PlayerGui) local Text = Instance.new('TextLabel', guithingyidk) Text.Position = UDim2.new(0.5,0,0.5,0) Text.Text = "You Are Dead" Text.TextColor3 = Color3.new(1,0,0) Text.TextSize = 100 dead = true wait(6) dead = false end wait() end
Closed as Not Constructive by minikitkat
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?