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

BillboardGui disappearing when player dies?

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

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. ;)

1 comment

0

still doesnt come back when the player dies :/

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