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

Show Gui When player dies ? (UNANSWERED)

I have Made A Gui. I need it to show when the player dies.

So like...

Local player = NEED HELP

if player.Humanoid.Health == 0 then Guisname.Show()

3 answers

✓ Accepted answer
function Died()
plGui = game.Players.LocalPlayer.PlayerGui
scrnGui = Instance.new("ScreenGui",plGui)
fr = Instance.new("Frame",scrnGui)
txt = Instance.new("TextLabel",scrnGui)

fr.Size = UDim2.new(0,2000,0,2000)
fr.BackgroundColor3 = BrickColor.new("Really red").Color
txt.Position = UDim2.new(--[[position you want]]--
txt.Size = UDim2.new(--[[Size u want]]--)
txt.TextScaled = true
txt.Text = "You are dead"
end

if player.Character.Humanoid.Health == 0 then
Died()
end

remember that UDim2 values go as (0,0,0,0) only change the second numbers > (0,1,01)

 game.Players.PlayerAdded:connect(function(plr)
    player.CharacterAdded:connect(function(chr)
        chr:WaitForChild("Humanoid").Died:connect(function()
            plr:WaitForChild("PlayerGui").ScreenGui.Frame.Visible = true
        end)
    end)
end)

 

I answered this question before,also it would be beneficial to look up Died() Method on wiki roblox.

Try this, do it in a local script though. In the gui = , area put like game.Players.LocalPlayer.PlayerGui.GUINAME.TheFrameName

gui =
if player.Humanoid.Health == 0 then
	gui.Visible = true
end

1 comment

0

I need to define that player is as in Every player

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