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

How can I make gui elements react to the position of the player's mouse?

I'm making a gui, and I want an image to spin when you highlight the frame that contains it with your mouse. I am pretty much completely lost here. All I need to know is how to detect when the mouse is hovering over a frame. Any help is appreciated, thanks!

P.S. Sorry for the lack of a script to work with :\

2 answers

To detect of the mouse is hovering over the frame do this

local mouse = game.Players.LocalPlayer:GetMouse()
local GUI = --get GUI Object

local Hover()
	if mouse.X >= GUI.X.Scale and mouse.X <= GUI.X.Scale + GUI.Size.X.Scale and mouse.Y >= GUI.Y.Scale and mouse.Y <= GUI.Y.Scale + GUI.Size.Y.Scale then
		return true
	else
		return false
end

I've never done this before but I looked up a few things and this should work

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