Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make it so when you die it says something on the screen?

It's confusing to me.

2 answers

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.

1 comment

0

Ayy cj and that's true

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

This discussion is preserved as it was. New answers, comments, and votes are closed.