Why am I getting the error, MouseButton1Click is not a valid member of ScreenGui?
Umm. You are trying to click a screenGui and MouseButton1Click is not a function of it…
It’s not a screengui. It’s a imagebutton.
If you notice the docs: https://developer.roblox.com/en-us/api-reference/class/GuiButton
You will see that there is an event of MouseButton1Click
.
But the ScreenGui and LayerCollector classes don’t:
https://developer.roblox.com/en-us/api-reference/class/LayerCollector
https://developer.roblox.com/en-us/api-reference/class/ScreenGui
If your Gui has a button then listen to it from that.
I recommend you use the Activated event instead: https://developer.roblox.com/en-us/api-reference/event/GuiButton/Activated
it generally works a bit better and it lets you know what input was used (i.e click, tap)
Hmmm why’s the ClassName ScreenGui then… ._.
I don’t know. The only screengui is my UI which I am aware doesn’t use MouseButton1Click.
Hi! I think you should consider reviewing DarkMode function. The output says the error is there
I legitimatley just noticed that at the same time, oh my god I need better eyes. Sorry everyone lmao
Just use the stack trace to traceback your code
@sjr04 has correctly answered your question. As the error states, MouseButton1Click is not a valid member of ScreenGui. Could you please share line 38 and the surrounding lines with us?
Don’t worry, I just missed something in the function. I had another mousebutton1click function inside the function.
No wonder, I have 500 lines of code haha and 300 of them are straight up functions