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

How do i make a surface gui image swap when a surface gui button is pressed?

Asked by 4 years ago

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) ~~~~~~~~~~~~~~~~~

0
First, you haven't told us what you want to do with the background. Without that information we are unable to help you. MrOpScripter 81 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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!

0
Thanks! i think i can experiment with this so i would say this was helpful! Coneyard 23 — 4y
Ad

Answer this question