It's been 3 years since I've consistently programmed in ROBLOX Lua, and thus the API has changed quite a bit since my hay day. I'm currently trying to get back into it, but I've run into a problem with GUIs.
I used to use this as a click function:
script.Parent.MouseButton1Down:connect(function() end)
but now it seems to no longer work. I can't find any new documentation on the ROBLOX developer site, so I was curious as to whether there was something I was doing wrong. I have also tried using :connect
and :Connect
but capitalization does not appear to be the problem.
Thanks.
Solved - forgot when to use local scripts.
The only thing I can think of being the issue is that this code is in a script that is not a LocalScript. If this is in a server script, it will not work as server scripts will not run in PlayerGui. They used to run in there when experimental mode was still available, but experimental mode was removed in late July.
The FilteringEnabled
property will not determine if experimental mode is active. It doesn't do anything now.
Also, you should use the GuiButton.Activated
event rather than GuiButton.MouseButton1Down
. The former is the recommended way of listening for GUI button clicks