Title says it all really
I'm just wondering, because I want to add console support later on and I know mousebutton1down wont work for console, but at the same time, I don't know how else to detect if a player has clicked on a certain button?
That really depends on what you're trying to do. I recommend using MouseButton1Click, MouseButton2Click, MouseButton1Up, MouseButton1Down, MouseButton2Up and even MouseButton2Down when using a single, simple function, for example, changing a team color, tweening a gui's size or position, changing texts, destroying and cloning things...
But UIS (UserInputService) should be used when making more complicated functions, and SPECIALLY when using keys on the keyboard.
Here, the first option (of the MouseButton1Click, etc.) should only be used when you're making a function with the MOUSE, and more basic functions. But, if you're trying to make functions with KEYS of the keyboard, which are normally more complex, I suggest you totally to, instead, use UIS.
EXAMPLES:
Using MouseButton1Click:
script.Parent.MouseButton1Click:connect(function() --script.Parent is a TextButton script.Parent.Text = "The button was pressed now." end)
When using UIS:
function onKeyPress(inputObject, gameProcessedEvent) --if key is pressed if inputObject.KeyCode == Enum.KeyCode.R then --if "R" key is pressed print("R was pressed") --Code, which is the example **print "R was pressed".** end end game:GetService("UserInputService").InputBegan:connect(onKeyPress) --Get UIS and check if player inputs any key (on the keyboard)
EDIT
If you want the UIS and pressing A on the console, simply set a function and then call it, like this:
function click() print("CODE GOES HERE!") end function onKeyPress(inputObject, gameProcessedEvent) --if key is pressed if inputObject.KeyCode == Enum.KeyCode.R then --if "R" key is pressed click() --Call click() function, which was set there up. end end game:GetService("UserInputService").InputBegan:connect(onKeyPress) --Get UIS and check if player inputs any key (on the keyboard) --And here you should put the "Clicking on A" function on the console... and then call the click() function, like how I did there up.
Hope I could help, and if you found this useful, please mark as the solution!
As always, keep the good scripting! :P