The code that is supposed to change the ImageLabel.Image does not work

Greetings fellow developers,
So, I am trying to make a 2d game.
The thing is that for animation I need to change different frames which change. However, when I tried coding this I run into some issues.

local ID = script.Parent.Image

wait(8)
		ID = "rbxassetid://5993496399"
	print("Time!!")
wait(8)
		ID = "rbxassetid://5993495870"

This simple local script is supposed to load a frame, wait 8 seconds and then change this specific image label to an other frame (ImageLabel.Image).

If you try this, I won’t work.

Your image will stay the same as you had previously set it.

The solution I could think of was to change the format:

“5993496399”
“rbxassetid://5993496399”

Regards,
Yolo

You are changing a variable in the script, not the ImageLabel’s image.
The fix is simple:

wait(8)
		script.Parent.Image = "rbxassetid://5993496399"
	print("Time!!")
wait(8)
		script.Parent.Image = "rbxassetid://5993495870"
2 Likes

You are setting the ID variable to the Image label then trying to just set the variable ID to “rbxassetid://5993496399” instead you need to set the ImageLabel’s Image property
so since ID is the image label just reference the property by doing ID.Image

> local ID = script.Parent.Image
> 
> wait(8)
> 		ID.Image = "rbxassetid://5993496399"
> 	print("Time!!")
> wait(8)
> 		ID.Image = "rbxassetid://5993495870"
1 Like