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

Why can't I change the value of ImageTransparency?

Asked by 9 years ago

I was trying to see how a particular image would look if it were to fade in/out.

a = game.Workspace.Part.SurfaceGui.Frame.ImageLabel.ImageTransparency

for i = 1,10 do
     a = a - 0.1
     wait(0.04)
end

For some reason, it doesn't change the value at all. When I made the script print the value of "a," the number did decrease, but for whatever reason, the gui remained unaffected.

1 answer

Log in to vote
1
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
9 years ago

When defining variables, do not set them to an object's property.

a will become whatever the ImageTransparency is equal to at the time it was created. a is in no way connected to the ImageTransparency property. It it simply a number, the same as a = 1 or a = 2

Set your variables to objects, not their properties.

Ad

Answer this question