Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Transform Doubles to Integers? TweenSize with Doubles?

Asked by 8 years ago

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

Log in to vote
3
Answered by 8 years ago

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

0
Thank you! TheArmoredReaper 173 — 8y
Ad

Answer this question