What's wrong with my button?

I have made a screen gui image button that when clicked it prints “Purchased”, but nothing is printed. Do anyone know this issue?

We can’t help with your issue if you don’t provide the code

2 Likes

Here, nothing in it

1 Like

But as an additional info, i put this code inside a local script, and i put the button inside a scrolling frame

Looks like it should work, is there any other code above the code you just sent? If so, show that as well as it could be that someone is stopping the code from creating the event.

Do you get any errors when you run the game that lead to the localscript?

1 Like

Neither the code it written with another, nor the code gives me error (Don’t mind my grammmar)

Wait, is it a GuiButton? It should work with it.

1 Like

if it’s a gui button try using

script.Parent.Activated:Connect(function()
1 Like

If you have an output you can see it printed.

1 Like

This is what I got with my own button:

robloxapp-20210723-1710435.wmv (466.4 KB)

1 Like

There may be an invisible (Visible but transparency is 1) Gui blocking in-front of it.

1 Like

Probably you put loops in above that code which creates a yield, that’s why the event doesn’t assigned at all. That’s why it didn’t printed.

1 Like

Have you tried setting it’s ZIndex and LayoutOrder to a high number, and enabled Active in properties? Another UI may be blocking it.

1 Like

With all the information you have given, there is no reason for it not to work. Is gui in workspace? Then it wouldnt work.

1 Like

The gui is in the starter gui and it is srolling fram, inside it image button with local script

I didn’t check the first two, but the last one which is “Active” i checked it and it is true

I only wrote

script.Parent.MouseButton1Click:Connect(function()

--   my scripts
end)

No there isn’t anything, the button is colored in gray when i hover, but when i click on it it doesn’t do anything

That should be working. As a script itself it’ll be working but it’s conflicting with something else.

Can you send a picture of the hierarchy and also any other scripts involved?

1 Like

I didn’t work either, it maybe from the gui or something