How do I keep overhead BillBoardGUI after player dies?
What I am trying to do?
- I am trying to make it so when you touch a part you get a BillBoardGUI above your head but the part also kills you
What I have tried?
- I have tried making a while loop to see if player health is 0 and if it is 0 it will wait 5 seconds for player to load then makes the BillBoardGUI again
What I have tried script:
01 | local DemonPart = script.Parent |
04 | DemonPart.Touched:Connect( function (hit) |
05 | if hit.Parent:FindFirstChild( "Humanoid" ) then |
10 | local hitplayer = hit.Parent |
11 | local player = game.Players.LocalPlayer |
12 | hitplayer.Humanoid.Health = 0 |
16 | local demonbill = Instance.new( "BillboardGui" ) |
17 | demonbill.MaxDistance = 25 |
18 | demonbill.StudsOffset = Vector 3. new( 0 , 1.3 , 0 ) |
19 | demonbill.Name = "demonbill" |
20 | demonbill.Active = true |
21 | demonbill.Size = UDim 2. new(. 200 , 0 , . 50 , 0 ) |
22 | demonbill.Parent = hit.Parent.Head |
25 | local textlabel = Instance.new( "TextLabel" ) |
26 | textlabel.Text = "DEMON" |
27 | textlabel.TextColor 3 = Color 3. new( 255 , 0 , 0 ) |
28 | textlabel.BackgroundTransparency = 1 |
29 | textlabel.TextSize = 30 |
30 | textlabel.Font = Enum.Font.GothamBold |
31 | textlabel.Active = true |
32 | textlabel.Size = UDim 2. new(. 200 , 0 ,. 50 , 0 ) |
33 | textlabel.Parent = demonbill |
36 | if hitplayer.Humanoid.Health = = 0 then |
39 | local demonbill = Instance.new( "BillboardGui" ) |
40 | demonbill.MaxDistance = 25 |
41 | demonbill.StudsOffset = Vector 3. new( 0 , 1.3 , 0 ) |
42 | demonbill.Name = "demonbill" |
43 | demonbill.Active = true |
44 | demonbill.Size = UDim 2. new(. 200 , 0 , . 50 , 0 ) |
45 | demonbill.Parent = hit.Parent.Head |
48 | local textlabel = Instance.new( "TextLabel" ) |
49 | textlabel.Text = "DEMON" |
50 | textlabel.TextColor 3 = Color 3. new( 255 , 0 , 0 ) |
51 | textlabel.BackgroundTransparency = 1 |
52 | textlabel.TextSize = 30 |
53 | textlabel.Font = Enum.Font.GothamBold |
54 | textlabel.Active = true |
55 | textlabel.Size = UDim 2. new(. 200 , 0 ,. 50 , 0 ) |
56 | textlabel.Parent = demonbill |
What I did after it didn't work?
- I removed the if player health = 0 because I thought there was an easier way
What is my script now?
01 | local DemonPart = script.Parent |
04 | DemonPart.Touched:Connect( function (hit) |
05 | if hit.Parent:FindFirstChild( "Humanoid" ) then |
10 | local hitplayer = hit.Parent |
11 | local player = game.Players.LocalPlayer |
12 | hitplayer.Humanoid.Health = 0 |
16 | local demonbill = Instance.new( "BillboardGui" ) |
17 | demonbill.MaxDistance = 25 |
18 | demonbill.StudsOffset = Vector 3. new( 0 , 1.3 , 0 ) |
19 | demonbill.Name = "demonbill" |
20 | demonbill.Active = true |
21 | demonbill.Size = UDim 2. new(. 200 , 0 , . 50 , 0 ) |
22 | demonbill.Parent = hit.Parent.Head |
25 | local textlabel = Instance.new( "TextLabel" ) |
26 | textlabel.Text = "DEMON" |
27 | textlabel.TextColor 3 = Color 3. new( 255 , 0 , 0 ) |
28 | textlabel.BackgroundTransparency = 1 |
29 | textlabel.TextSize = 30 |
30 | textlabel.Font = Enum.Font.GothamBold |
31 | textlabel.Active = true |
32 | textlabel.Size = UDim 2. new(. 200 , 0 ,. 50 , 0 ) |
33 | textlabel.Parent = demonbill |