Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I change the image in a Surface GUI?

I want to change the image on a Surface GUI whenever I a button.

The script is:

script.Parent.MouseButton1Click:connect(function()
	script.Parent.AutoButtonColor = false
	script.Parent.Active = false
	script.Parent.BackgroundTransparency = 0.3
	wait(2)
	script.Parent.Sound:Play()	wait(2)	script.Parent.Sound:Stop()
	script.Parent.Parent.Image.Image = ("http://www.roblox.com/asset/?id=156684759")
	wait(60)
	script.Parent.AutoButtonColor = true
	script.Parent.Active = true
	script.Parent.BackgroundTransparency = 0
	script.Parent.Parent.Image.Image = ("http://www.roblox.com/asset/?id=158928904")
end)

Whenever I press the button, the Image on the Surface GUI goes white. I waited for a minute however the image didn't show.

1 answer

✓ Accepted answer

Are you sure that the image id is correct? You need to subtract 1 from your id before pasting it into a decal or texture. For example, if your decal id=7648202 then you would change it to id=7648201. (The last number was changed)

1 comment

0

Oh! Thanks for that, I'd read about that on LuaLearners before. I'd completely forgot! Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.