Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I keep overhead BillBoardGUI after player dies?

Asked by 4 years ago

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:

local DemonPart = script.Parent
local db = false

DemonPart.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        if db == false then
            db = true
            print(db)

            local hitplayer = hit.Parent
            local player = game.Players.LocalPlayer
             hitplayer.Humanoid.Health = 0



        local demonbill = Instance.new("BillboardGui")
        demonbill.MaxDistance = 25
        demonbill.StudsOffset = Vector3.new(0,1.3,0)
        demonbill.Name = "demonbill"
        demonbill.Active = true
        demonbill.Size = UDim2.new(.200, 0, .50, 0)
        demonbill.Parent = hit.Parent.Head


        local textlabel = Instance.new("TextLabel")
        textlabel.Text = "DEMON"
        textlabel.TextColor3 = Color3.new(255,0,0)
        textlabel.BackgroundTransparency = 1
        textlabel.TextSize = 30
        textlabel.Font = Enum.Font.GothamBold
        textlabel.Active = true
        textlabel.Size = UDim2.new(.200,0,.50,0)
        textlabel.Parent = demonbill

            while true do
                if hitplayer.Humanoid.Health == 0 then

                    wait(5)
                    local demonbill = Instance.new("BillboardGui")
        demonbill.MaxDistance = 25
        demonbill.StudsOffset = Vector3.new(0,1.3,0)
        demonbill.Name = "demonbill"
        demonbill.Active = true
        demonbill.Size = UDim2.new(.200, 0, .50, 0)
        demonbill.Parent = hit.Parent.Head


        local textlabel = Instance.new("TextLabel")
        textlabel.Text = "DEMON"
        textlabel.TextColor3 = Color3.new(255,0,0)
        textlabel.BackgroundTransparency = 1
        textlabel.TextSize = 30
        textlabel.Font = Enum.Font.GothamBold
        textlabel.Active = true
        textlabel.Size = UDim2.new(.200,0,.50,0)
                    textlabel.Parent = demonbill

                end
            end

        end
    end
end)

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?

local DemonPart = script.Parent
local db = false

DemonPart.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        if db == false then
            db = true
            print(db)

            local hitplayer = hit.Parent
            local player = game.Players.LocalPlayer
             hitplayer.Humanoid.Health = 0



        local demonbill = Instance.new("BillboardGui")
        demonbill.MaxDistance = 25
        demonbill.StudsOffset = Vector3.new(0,1.3,0)
        demonbill.Name = "demonbill"
        demonbill.Active = true
        demonbill.Size = UDim2.new(.200, 0, .50, 0)
        demonbill.Parent = hit.Parent.Head


        local textlabel = Instance.new("TextLabel")
        textlabel.Text = "DEMON"
        textlabel.TextColor3 = Color3.new(255,0,0)
        textlabel.BackgroundTransparency = 1
        textlabel.TextSize = 30
        textlabel.Font = Enum.Font.GothamBold
        textlabel.Active = true
        textlabel.Size = UDim2.new(.200,0,.50,0)
        textlabel.Parent = demonbill



        end
    end
end)

Answer this question