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

BillboardGui disappearing when player dies?

Asked by 8 years ago

There's a part in workspace called BillPart, with a billboardgui inside of it named nameb. When a player joins, the billboardgui gets cloned, and the cloned gui's adornee gets set to the player's head. So, the script works but the BillboardGui disappears when the player dies. Script:

-- skip this part
game.Players.PlayerAdded:connect(function(plr)
    while not plr.Character do wait() end
    local g = game.Workspace.BillPart.Nameb:Clone()
    g.Parent = game.Workspace.BillPart
    game.Workspace.BillPart.Nameb.Adornee = plr.Character.Head
    game.Workspace.BillPart.Nameb.SizeOffset = Vector2.new(0,1)
    while true do
        wait()
        game.Workspace.BillPart.Nameb.TextButton.Text = plr.Name.." | Level: "..plr.leaderstats.Lvl.Value
    end
end)

-- this is what i tried to make it not go away
game.Players.PlayerAdded:connect(function(plr)
    while not plr.Character do wait() end
    plr.Character.Humanoid.Died:connect(function()
        local g = game.Workspace.BillPart.Nameb:Clone()
        g.Parent = game.Workspace.BillPart
        game.Workspace.BillPart.Nameb.Adornee = plr.Character.Head
        game.Workspace.BillPart.Nameb.SizeOffset = Vector2.new(0,1)
        while true do -- yes i know i could use the changed event
            wait()
            game.Workspace.BillPart.Nameb.TextButton.Text = plr.Name.." | Level: "..plr.leaderstats.Lvl.Value
        end
    end)
end)

1 answer

Log in to vote
0
Answered by 8 years ago

It says TextButton, not TextButton.Text. Maybe that can help ;).

I think the main problem is that if clones itself, but it doesn't repeat cloning itself. Put the Cloning and such under the while loop. Please respond on what happens. ;)

0
still doesnt come back when the player dies :/ Operation_Meme 890 — 8y
Ad

Answer this question