How to change image using only script?

local button = script.Parent.Parent.gg1
function OnClick()
        print("works")
	script.Parent.Parent.Parent.Main.Image = "rbxassestid://138883730"
end

button.MouseButton1Click:Connect(OnClick)

It prints “works” and it does not give me any error. However, the image is not changing. Can anyone help? Thanks!

you literally spelt rbxassestid wrong, it’s rbxassetid

2 Likes

If you want to make sure that the format is right, copy only only the imqge ID, insert it in image value in decal or image label and then copy the value (roblox studio will automatically adjust the format)

Oh, bruh you were right thanks! :slight_smile: