Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

MouseHover And MouseButton1Down?

Asked by
Filipalla 504 Moderation Voter
8 years ago
Edited 8 years ago

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!

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. FiredDusk 1466 — 8y
0
Maybe I Could Use GetMouse Instead Filipalla 504 — 8y
0
I Could Not Filipalla 504 — 8y
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 Async_io 908 — 8y
0
Typing with capital letters is very annoying, and should only be used for titles. User#11440 120 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago

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!

0
This Was Not The Answer I Was Asking For Just So You Know! Filipalla 504 — 8y
0
That is what you asked for! Script0rr 65 — 8y
Ad

Answer this question