Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

MouseHover And MouseButton1Down?

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!

5 comments

0

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.

0

Maybe I Could Use GetMouse Instead

0

I Could Not

1

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

0

Typing with capital letters is very annoying, and should only be used for titles.

1 answer

✓ Accepted answer

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!

2 comments

0

This Was Not The Answer I Was Asking For Just So You Know!

0

That is what you asked for!

This discussion is preserved as it was. New answers, comments, and votes are closed.