|
| 25 Apr 2016 02:00 AM |
| How do I activate a function with a mouse click. |
|
|
| Report Abuse |
|
|
|
| 25 Apr 2016 02:02 AM |
Well it depends on if we're talking about GUIs or ClickDetectors.
ClickDetector:
clickDetector.MouseClick:connect(function(player) -- Activated! end)
GUIs:
guiElement.MouseButton1Click:connect(function() -- Activated! end)
|
|
|
| Report Abuse |
|
|
| |
|
|
| 25 Apr 2016 03:31 AM |
He may also be speaking about simply clicking, without any instances required within the game for the event to take place. You could put this script inside of a local script in the instance called starterplayerscripts.
local Mouse = game.Players.LocalPlayer:GetMouse()
Mouse.Button1Down:connect(function() print('pressed left mouse button') end)
Mouse.Button1Up:connect(function() print('released left mouse button') end)
Mouse.Button2Down:connect(function() print('pressed right mouse button') end)
Mouse.Button2Up:connect(function() print('released right mouse button') end) |
|
|
| Report Abuse |
|
|