Scale cannot be assigned to

Whenever attempting to scale an ImageLabel based on the percentage of your health, it gives the error Scale cannot be assigned to

What am I doing wrong? I’m correctly defining the humanoid and it’s health, the exact same definition works in another local script I made

Code:

local percentage = hum.Health/hum.MaxHealth
print(percentage)
script.Parent.Size.Y.Scale = percentage*0.2
print(script.Parent.Size.Y.Scale)

You can’t assign individual X, Y and Z values in vectors or UDims. Try doing it like this:

local bar = script.parent
bar.Size = UDim2.new(bar.Size.X.Scale, bar.Size.X.Offset, percentage*0.2, bar.Size.Y.Offset)
3 Likes

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