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

Transform Doubles to Integers? TweenSize with Doubles?

I am designing an HP bar that works depending on a player's current Health and MaxHealth, and it Tweens the bar's size to smoothen the changes...

The only problem is my TweenSize code doesn't work, and just gives a "Unable to cast double to token" error message.

CODE :

player = game.Players.LocalPlayer
char = player.Character
human = char.Humanoid
HP = script.Parent

while wait(.1) do
	HP:TweenSize(UDim2.new(0, (human.Health*311)/human.MaxHealth), 0, 24)
end

Any help is appreciated!

  • TheArmoredReaper

1 answer

✓ Accepted answer

Doubles aren't the issue
You missed a spot

HP:TweenSize(UDim2.new(0, (human.Health*311)/human.MaxHealth, 0, 24)) 

The issue was where your brackets were

1 comment

0

Thank you!

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