Billboard GUI not working

in starterCharacter. Normal script.

script




local head = script.Parent:WaitForChild("Head")

local HpBoard = Instance.new("BillboardGui",head)

HpBoard.StudsOffset = Vector3.new(0,3,0)

local HPLabel = Instance.new("TextLabel",HpBoard)

HPLabel.BackgroundTransparency = 1

HPLabel.TextScaled = true

HPLabel.TextColor3 = script.Parent:WaitForChild("TeamColor3").Value

while true do

wait(.5)

HPLabel.Text = script.Parent.Humanoid.Health.." / "..script.Parent.Humanoid.MaxHealth

end
1 Like

To be clear, is this in a character model or in StarterCharacterScripts? Server scripts don’t work in StarterCharacterScripts.

okay… how about this
still does not work

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		wait(1)
		local head = character:WaitForChild("Head")
		local HpBoard = Instance.new("BillboardGui",head)
		HpBoard.StudsOffset = Vector3.new(0,3,0)
		local HPLabel = Instance.new("TextLabel",HpBoard)
		HPLabel.BackgroundTransparency = 1
		HPLabel.TextScaled = true
		HPLabel.TextColor3 = character:WaitForChild("TeamColor3").Value





		while true do
			wait(.5)
			HPLabel.Text = character.Humanoid.Health.." / "..character.Humanoid.MaxHealth
		end

	end)
	
end)

Where did you place the script?

IN workspace. :confused: :confused:

uh what dosn’t work? the gui? any output error? i need more information

You just want to make a script that detects when this changes inside of the gui and get the player from there. You can detect a value/property change by using Instance | Roblox Creator Documentation

i don’t suggest you do loops, what i would do is a function humanoid.health:changed()

Yes. Or you could use Instance:GetPropertyChangedSignal. A-lot of loops lag the game. :neutral_face:

i agree, it effect the performance and it cause server lag

1 Like

No error. Billboard gui is not visible. Text label is enabled and so is the billboard.

It appears that you haven’t defined a size for the UI objects, meaning they are infinitely small and therefore invisible. If you try setting the size of the BillboardGui and the TextLabel to UDim2.new(1, 0, 1, 0), the objects should appear.

1 Like