I’m creating my own play button and tried to script it but it only just comes up with a red line and when I finished off the function message, the end) didn’t appear so I don’t know what to do. Please answer if you know what is wrong with the script! Thanks!! image|690x388
local Screen = script.Parent.Screen
local PlayButton = Screen.Play
PlayButton.MouseButton1Down:Connect(function()
print("button was pressed or clicked")
end)
MouseButton1Down works for every platform! MouseButton1Click only works for computer!
MouseButton1Click is indeed compatible with all platforms, and is perfectly fine to use.
@galaxy63197 and the solution is just to place end) at the end of your function; however, if you don’t put anything inside of the function, nothing is going to happen. You need to give the script some instructions.
MouseButton1Down does, its true i’ve experimented with it before and i used mousebutton1click gui and went on a mobile device and pressed the gui it didnt do anything. MouseButton1Down did the job for me. Maybe MouseButton1Click works with other platforms now? Because i tested this a year ago.
If you don’t close the function with and end, the script editor will continue to show the red line, which in your case, is likely signaling a syntax error.
ButtonName.MouseButton1Click:Connect(function()
--Write code that you want to be executed when the button is clicked inside this function.
end)