Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is MouseButton1Click Not working?

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.

2 comments

0

it used to run fine in both localscripts and scripts , but does not work anymore

0

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

2 answers

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

6 comments

1

This code should work.

0

lol, its supposed to be for guis, the "mission1" is a variable to a gui, check the wiki.

0

also MouseButton1Click is a function, it is not a reference to mouse, I also might be wrong , ill look that up

0

Code did not work

0

Is mission1 a textbutton or imagebutton? If not, then you need to change it to either of those.

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

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

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