script.parent.MouseButton1Click:Connect(function (player)
	print("Registered click")
	if leftOn == 0 then
		leftOn = 1
		print("Changed to 1")
	else
		leftOn = 0
		print("Changed to 2")
	end
end)

I have a simple ScreenGui that changes a variable however when clicked I cannot get any output with the prints and it also doesn't change the variable. I'm sure it might be something simple so thought I would ask the community since I can't figure it out

4 comments

2

Parent with a capital?

0

Doesn't make a difference.

0

leftOn is nil because it isn't defined

0

I define that before this simple click function and even so it wouldn't explain why the GUI wasn't registering a click.