So Basicly Im Trying To Make It When MouseButton1 Is Down And It's Hovering Over The Button Something Will Happen! Searched Around The Wiki For A While Now And Could Not Find Anything :/
Edit: Im Making An MS Paint Kind Of Thing And I Want It So You Can Drag The Mouse Instead Of Clicking Every Single Button You Want To Paint!
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:
--MUST BE IN LOCAL SCRIPT!-- local player = game.Players.LocalPlayer -- we find the player local Mouse = Player:GetMouse() -- we get the players mouse Mouse.Button1Down:connect(function() -- we check to see if the mouse has been clicked print("Button1Down") -- if so, we 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() -- we check to see if the mouse has been clicked print("Button1Down") -- if so, we 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()-- Check to see if player has hovered over the object print("Hovered!") -- Print Hovered! end)
I hope I helped you with this, and increased your knowledge of lua!