Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I change the image in a Surface GUI?

Asked by
Sam4550 42
10 years ago

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

Log in to vote
1
Answered by 10 years ago

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)

0
Oh! Thanks for that, I'd read about that on LuaLearners before. I'd completely forgot! Thanks! Sam4550 42 — 10y
Ad

Answer this question