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 make a surface gui image swap when a surface gui button is pressed?

I've been experimenting with doing this and i have had no luck so far. What i'm trying to do is have an image label on a block change when you press a surface gui text button on one side and change back when you have pressed a surface gui text button on the other side. Kinda like a loop where even if you kept pressing one side it would loop back around but i have no idea where to start on this. I'm 110% i'm very wrong on this script but its all i've been able to come up with.~~~~~~~~~~~~~~~~~ script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.1Image.ImageTransparency = 1 script.Parent.Parent.2Image.ImageTransparency = 0 end)


1 comment

0

First, you haven't told us what you want to do with the background. Without that information we are unable to help you.

1 answer

✓ Accepted answer

Your issue is your changing the back to invisible and visible instantly so It's just gonna do nothing. It is working though, It's so fast you can't see it.

Might I Recommend:

script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.1Image.ImageTransparency = 1 
wait(--[[The time it will be invisible for]] 1)
script.Parent.Parent.2Image.ImageTransparency = 0 
end)

That code will make it invisible for 1 second.

If you would like it to be a switch then:

local On = false

script.Parent.MouseButton1Click:Connect(function() 
if on == false then
script.Parent.Parent.1Image.ImageTransparency = 0
else
script.Parent.Parent.1Image.ImageTransparency = 1
end
end)

Upvote if this helped!

1 comment

0

Thanks! i think i can experiment with this so i would say this was helpful!

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