Health GUI Problem

I’m working on making a vehicle health GUI and it’s not going to well.

They should be matching. Here’s the setup for it:

Here’s the code inside the Main local script:
local speeder = script.Parent.Parent.Parent
local humanoid = speeder.Humanoid
local healthGui = script.Parent
local healthColor = Color3.fromRGB(255,0,0):Lerp(Color3.fromRGB(85,255,0),humanoid.Health/humanoid.MaxHealth)
local healthChange = humanoid.Health/humanoid.MaxHealth
healthGui.Health.Meter.BackgroundColor3 = healthColor

1 Like

Localscripts cannot run in workspace, they must be put in StarterGui/PlayerGui, StarterPack/Backpack, PlayerScripts or the Character


That fixed it, thank you very much!

It’s glitching and I’m not sure what the problem is.
It gets to a certain point and goes straight down to 0.

Not sure if this will fix it but after the length of time in the TweenSize function, you have to add a true which allows it to be overridden if TweenSize is called on the Meter again
healthGui.Health.Meter:TweenSize(,0,1,0),“In”,“Linear”,1, true)

1 Like

Didn’t fix it but could it be because I converted it from a player health GUI to the vehicle health bar? The vehicle doesn’t have any scripts yet it’s just got a humanoid and a health bar GUI

Could you give me a file with the code and the BillboardGui. I took the code and it seems to be working for me.

devforumhelp1.rbxm (10.5 KB)

Found the issue, it is size of the BillboardGui. It is set to (1,0,1,0) and once the bar leaves the middle it stops getting rendered. What you can do is set the size of the BillboardGui to (0,560,0,30) and set the Meter Frame size to (1,0,1,0) and set the position of the same frame to (0,0,0,0)

Or the fixed version here (does the above): devforumhelp1fixed.rbxm (10.5 KB)

1 Like