I am trying to change the image of an ImageLabel according to an IntValue. I put a LocalScript inside of the ImageLabel. Here is the script:
local RS = game:GetService("ReplicatedStorage")
local windPercentage = RS.WindPercentage
script.Parent.Visible = true
local images = {
"7563390890",
"7563385248",
"7563383984",
"7563383179",
"7563382272",
"7563381326",
"7563380153",
"7563372917",
"7563367552",
"7563357428",
"7563356058",
"7563355145",
"7563353465",
"7563350969",
"7563346084",
"7563344806",
"7563343722",
"7563342412",
"7563340834",
"7563339787",
"7563338195",
}
while task.wait() do
if windPercentage.Value == 0 then
script.Parent.Visible = false
else
script.Parent.Image = "rbxassetid://"..images[windPercentage.Value]
end
end
- The script prints no errors.
- I used print() to test, and everything was as it should be.
- The ImageLabel is always visible, and not transparent.
- The IntValue properly changes.
- The images are valid and approved.
I don’t get what’s going on. Everything in the script works perfectly, but when I go in-game I can see that the image property is never changing. It just appears invisible, and the image property is always set to “rbxassetid://7563338195.” Why?
Edit: I found out that the image appears when the IntValue goes to 21, but is invisible if anything else.