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

Is there a way to find which side the mouse entered my ImageButton?

So I have this basic script I'm making, when a users mouse enters the ImageButton, it rotates to 25 degrees, then when the mouse leaves, it goes back to normal.

My question is, can I find which side the users mouse entered on? I am trying to make it so when the user enters on the left side, the rotation will be 155 degrees instead of 25.

Here is my current script (under image button):

local imgbutton = script.Parent

function MouseEnter()
	imgbutton.Rotation = -25 --mouse enter on right
	--mouse enter on left here
end

function MouseLeft()
	imgbutton.Rotation = 0
end

imgbutton.MouseEnter:Connect(MouseEnter)
imgbutton.MouseLeave:Connect(MouseLeft)

What feature can I use to achieve this? I'm extremely confused, and I'm unsure if there is a way to do this, any help is appreciated!

1 answer

Could you put invisible GUIs next to the one which you want to rotate. Then detect which GUI it passed through (to get to the main one). Just put a debounce kind of variable in there too :)

2 comments

0

So there is no actual ROBLOX feature, or is there one? (thanks for the way to do it too)

0

Not that I'm aware of but I'm no expert haha. That's how I'd do it :)

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