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:
local player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
Mouse.Button1Down:connect(function()
print("Button1Down")
end)
Understand? Let me explain in detail.
local player = game.Players.LocalPlayer
We get the local player, so we can see if they have pressed the mouse or not
local Mouse = Player:GetMouse()
We access the players mouse.
Mouse.Button1Down:connect(function()
print("Button1Down")
end)
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,
script.Parent.ClickDetector.MouseHoverEnter:connect(function()
print("Hovered!")
end)
I hope I helped you with this, and increased your knowledge of lua!
5 comments
If this is for guis, you should use MouseButton1Click and for the mouse hovering, you use the event 'MouseEnter' and 'MouseLeave'. I gtg now so I won't respond.
Maybe I Could Use GetMouse Instead
I Could Not
First things first, Typing Like This Is Not Pleasant On The Eyes, Nor Is It Easy To Read, instead type like this. You need to give more details into what you're saying as we can not help you. Give us a few more examples, a few gifs, etc etc. You could make a boolean value that goes true when MouseButton1Down is true, and make it so that whenever that boolean is true, little circles will be made at
Typing with capital letters is very annoying, and should only be used for titles.