Change button image attempt to call field image

I have been writing a script that makes a button gui change it’s image:

while true do
script.Parent.Image = "hardtowriteidhere"
wait(5.5)
script.Parent.Image = "anotherimageisexample"
wait(5.5)
end

And it error prints this:
Players.Conejin_Alt.ScreenGui.ImageButton:4: attempt to call field ‘Image’ a string value

I’m pretty sure you have to upload the image to Roblox and use the decal ID. If using the decal id on its own doesn’t work, put rbxassetid:// before the id.
Put the choices suggested in quotation marks.

1 Like

I didn’t write the IDs cause they were too long, I added them: rbxassetid://numbers. I mean that I wrote in the code but not here

I went to look up your error. It may be that you concatenated wrong. It would be easier if we could also see the exact code so that we could assist more.

Is the item an ImageLabel or ImageButton. Can I see the hierachy please?

while true do
script.Parent.Image = "rbxassetid://863617791"
wait(5.5)
script.Parent.Image = "rbxassetid://1365524695"
wait(5.5)
end

This is the code

ImageButton

this text fills the 30chars req lol

Wait… Do I must write this on local script?

If this is a ScreenGui then yes.

1 Like

My bad, I set a script. Well, I haven’t tested this yet, but if this doesn’t work then I will still have this as solution and find for myself the problem :+1:

1 Like

Well, it still doesn’t works, :expressionless:

Can you please send the hierarchy of the pathway to this? I used your same code with this hierarchy and it worked. Your code is in the LocalScript.

hierarchy