Hello, I have an error in my script that I can’t wrap my head around.
I have a button that is supposed to fire the code when clicked, but the event never fires. The first print works but the second doesn’t. Just so you know, it is a local script parented to an image button and I have been clicking the button to test it. Here is the script:
EDIT: Sorry for using a screenshot of my code, I did not really know how to write in code format lol.
Alternatively you could make this a function and connect the events like
local button = script.Parent
local function GuiStuff()
script.Parent.BallOutline.ImageTransparency = 1
script.Parent.BlockOutline.ImageTransparency = 0
-- you get the idea out the last 2 lines of code here
end)
button.MouseButton1Click:Connect(GuiStuff)
If this happens to not work check if your GUI Button is a TextButton or ImageButton, if not that may be the issue, also make sure this is a local script and not a server script (script)
Can you show me a picture of where the script is under and what the parent is? I had this issue once when the script was under the button but not the screenGui
This line may have prevented the button because of Z index. Before you click the button, Z index is invalid but after you change the transparency of the image, the button must have gone under the image. If this image and button is overlapping, maybe z index is causing it.
Try changing the Z index of the image buttons. Block’s z index must be higher than others.