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

Scale cannot be assigned to?

Asked by
u_g 90
10 years ago

While I was making a customized health bar, it said "Scale cannot be assigned to", even though it's a property of Frame. Please help. Here's the code:

script.Parent.Size.X.Scale = decimalbarsize

(decimalbarsize = 0.2)

2 answers

Log in to vote
2
Answered by 10 years ago

isnt it ....~~~~~~~~~~~~~~~~~ decimalbarsize = script.Parent.Size.X.Scale ~~~~~~~~~~~~~~~~~??

0
Actually, I'm trying to set the Scale, not set the variable. u_g 90 — 10y
0
try script.Parent.Scale.Size.X = decimalbarsize iwilllandonmars 55 — 10y
0
The only problem with that is that X consists of two numbers: the Scale, and Offset. I wouldn't be able to put in both numbers. u_g 90 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

When you change a property that has multiple variables in it, you have to edit the property as a whole, instead of a specific variable. So in order to change the size or position of a GuiObject, you would have to do this:

local Frame = script.Parent
Frame.Size = UDim2.new(XScale,XOffset,YScale,YOffset) --Replace the words with numbers or variables. Example: UDim2.new(0,25,0,10)

Hope this helped!

Answer this question