Need help with my tweening script?

So my pets deal 20 damage in total and the chest is 100 hp, so the bar should be 0 in size in 5 seconds.
However the bar tweens way too much at the end and I have no idea why, here’s a video.

local function tweenHealthBar(totalDamage)
	local health = script.Parent.Parent.Health.Value
	local maxHealth = script.Parent.Parent.MaxHealth.Value
	health = health - totalDamage
	local tweenBar = tweenService:Create(FG,,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),
		{ *5,0,6,0)}

	while true do wait()
		if #plrsClicked > 0 then
			for i, plrName in pairs(plrsClicked)  do
				if game.Workspace[plrName] then
					local plrObj = game.Players[plrName]
					if dealDamage then
						local totalDamage = checkTotalDamage(plrObj)
						print(totalDamage.." total damage")



Bar properties

Hey, while I do not know the answer, there are a few things that could be improved in your script. Firstly, take a look at this article:

TL;DR: Use the task library, in your case, you should replace wait() with task.wait().

You also want to destroy the Tween created by TweenService:Create(...), since this can also improve performance.

Try to debug by placing print here and there. Weirdly enough, when the tween almost reaches the end, it seems like the video was skipped by some frames. Maybe there are some unexpected spikes (which shouldn’t happen).

Little tip: Instead of changing the size with a value more than 1, Just make it 1 and change the BillboardGui to however any size you want.

Actual Answer: Multiplying makes the problem worse, because the lowest value would be 1 multiplied by the value.

Hmmm didn’t fix


I can’t help any more, because my studio is stuck on loading.
This is the image

No matter what section I go to, it keeps getting stuck and shows a screen of 3 dots sizing big to small like it was solving the problem. It keeps annoying me and even restarting my computer can’t help any more. I’m sorry.

Edit: nevermind I got warned for posting the images of “S” and “B”.