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

Track Mouse is Mouse over GUI?

Hello, I want to track if the Mouse is over any GUI (also the Default HUD, from Roblox), with other words i want to track the Color of the Mouse. If the Mouse is Black or White. How can I do this?

Thank you for you Help!

3 comments

0

What do you mean? You want to check if the mouse hovers above the GUI?

0

If so.. you can use "MouseEnter" and "MouseLeave" to check if a mouse is hovering over the GUI.. and if it stopped hovering over it. Instead of writing "MouseButton1Click" dp "MouseEnter"&"MouseLeave".

0

why r u ignoring us..

1 answer

For this you gotta use the "MouseEnter" and if you want "MouseLeave" events, these 2 will fire when the local player's mouse is hovering over a gui or stopped doing so.

local ui = script.Parent -- or whereevr youre guis is

ui.MouseEnter:Connect(function()
	print("Mouse Is Hovering.")
end)

ui.MouseLeave:Connect(function()
	print("Mouse Is No Longer Hovering.")
end)

It's that easy, but for the checking of the mouse's color, idk what ur talking about since there isnt a Mouse.Color property, but you can check the Mouse.Icon property and make it as you like.

-- so choose your mouse icon however you want it then use its id
local Mouse = game.Players.LocalPlayer:GetMouse()

if Mouse.Icon == "https://www.roblox.com/asset/?id=your id" then
	print("Mouse is looking like however you set it")
else
	print("Mouse is looking a different way")
end

and thats it, heres a useful link about Mouse and another

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