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

Why is MouseButton1Click Not working?

Asked by 9 years ago

For some reason MouseButton1Click does not work for prints or others, I looked up this problem, did not find any fixes

Code :

gui = script.Parent.Parent
main = gui.Main

can_mission = gui.Can_Do_Missions
missions = script.Parent
mission1 = missions.Mission1

mission1.MouseButton1Click:connect(function()
    print("Working")
end)

Please help. Also I've checked the location already, location is fine.

UPDATE: The problem has been solved, I found a solution that fixed it, thanks for trying to help.

0
it used to run fine in both localscripts and scripts , but does not work anymore LordPigMan 0 — 9y
0
UPDATE: The problem has been solved, I found a solution that fixed it, thanks for trying to help. LordPigMan 0 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

I'd make sure mission is a button gui of some sort, I can't see any other errors

1
This code should work. JamesLWalker 297 — 9y
0
lol, its supposed to be for guis, the "mission1" is a variable to a gui, check the wiki. LordPigMan 0 — 9y
0
also MouseButton1Click is a function, it is not a reference to mouse, I also might be wrong , ill look that up LordPigMan 0 — 9y
0
Code did not work LordPigMan 0 — 9y
View all comments (2 more)
0
Is mission1 a textbutton or imagebutton? If not, then you need to change it to either of those. aquathorn321 858 — 9y
0
You say mission1 is a variable to a GUI? Like, what, an object value? If thats the case, you need to do mission1.Value iaz3 190 — 9y
Ad
Log in to vote
-1
Answered by 9 years ago

There can be several things going on but I would check the zIndex of the button your trying to execute that on, because it might be under a gui and it is not allowing it to be clicked

another thing is the script might have loaded before the gui so you need to use :WaitForChild()

Answer this question