Before we start
I searched "MouseButton1Down" on google, and the roblox wiki came up straight away
Make sure to search to see if this question has been asked before
Lets start
So, it is best if both of these scripts are in LocalScripts.
Mouse Click
First, I will write some variables, and the MouseButton1Down event:
3 | local player = game.Players.LocalPlayer |
4 | local Mouse = Player:GetMouse() |
6 | Mouse.Button 1 Down:connect( function () |
Understand? Let me explain in detail.
1 | local player = game.Players.LocalPlayer |
We get the local player, so we can see if they have pressed the mouse or not
1 | local Mouse = Player:GetMouse() |
We access the players mouse.
1 | Mouse.Button 1 Down:connect( function () |
We check if the player has clicked the mouse, if so we print Button1Down, if not then we end the statement.
Mouse Hover
Because I explained above, I wont go in so much detail but I will still leave comments,
1 | script.Parent.ClickDetector.MouseHoverEnter:connect( function () |
I hope I helped you with this, and increased your knowledge of lua!