Billboard not moving at the same rate as model

I’d like to have a billboard properly move along with a model just above it.
When the model is moving, the billboard is indeed moving, just not near the model. That is, it starts with the model but appears to be moving at, say, 1/4 the rate of the model itself. This is not the case for all models… for some models, it is moving properly along at the same rate.
I have checked the settings for billboardgui and reviewed the code, but cannot find anything would cause this.

Here’s a link to a video of the models with the health bar NOT moving along with the model.

Here is the code for the billboard… setting its color, resizing, etc.

-- AngelBall Health Bar
local healthGUI = script.Parent
local thisModel = healthGUI.Parent
--healthGUI.Parent = thisModel.PrimaryPart

function UpdateHealthBar()
	local maxHP = thisModel:GetAttribute("HitPointsMax")
	local currHP = thisModel:GetAttribute("HitPoints")
	local healthchange = 1
	if (maxHP ~= nil and maxHP > 0) then
		healthchange = currHP/maxHP

		if (healthchange < .2) then
			healthColor = Color3.fromRGB(255,102,178)
		elseif (healthchange < .4) then
			healthColor = Color3.fromRGB(255,178,102)
		elseif (healthchange < 0.6) then
			healthColor = Color3.fromRGB(255,255,0)
		else
			healthColor = Color3.fromRGB(0,255,0)
		end
	else
		healthColor = Color3.fromRGB(0,255,0)
	end

	healthGUI.Health.Meter:TweenSize(UDim2.new(healthchange,0,1,0),"In","Linear",0.3)
	if (currHP <= 0) then

	end
	hpPercent = healthchange * 100.0
	healthGUI.Health.Meter.BackgroundColor3 = healthColor
	healthGUI.HealthLabel.TextColor3 = healthColor
	healthGUI.HealthLabel.Text = string.format("%.0f%%", hpPercent)
	healthGUI.HealthLabel.TextSize = 8
end

thisModel:GetAttributeChangedSignal("HitPoints"):connect(function()
	UpdateHealthBar()
end)

UpdateHealthBar()

Are the BillboardGuis being assigned to their heads by a script somewhere, or are they attached via Adornee? If they’re not already, can you set the Adornee of the gui to their head?

1 Like

I did add healthGUI.Adornee = thisModel
healthGUI is which is the billboard
thisModel is the model containing the health components.

Here is a screenshot of the hierarchy:
Screenshot 2023-08-31 154241

I’m thinking that I’m missing something! Perhaps a setting in the Humanoid?

Dang! That was the problem. I changed the Adornee setting to specify head and it works.
It is odd that in a very large number of my models, I did not need to set the Adornee!

Thank you for pointing that out. And correcting what specific object I needed to change. #Newbie

1 Like

Glad it worked out for you! I’m sure there are a number of reasons that could make the gui move if the adornee is the entire model. Specifying the head helps ensure it goes where you think it should!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.