Need help with MouseEnter

I have a problem, I have a frame on top (order) of a second frame (we can’t see the second frame cause of overlapping). Why does the second image keep triggering MouseEnter?

2 Likes

I’m pretty sure MouseEnter doesn’t care about Z-Index and only about X and Y

I might be wrong but this is just from my knowledge

So how i can have the real trigger when the mouse really enter into the zone and visible? what condition do i make ?

You could use MouseEnter and manually check if it’s the frame that should currently be at the top.

Additionally, you could put both into a table and sort the table in descending order of Z-Index and pick the first one.


Could I get an idea of what you’re making so I can assist you further with a better solution?

I making a button system for frames (for my game). So i use Mouse Enter and Mouse Leave to detect if the player its in the zone.

v.MouseEnter:Connect(function()
	selectBox.Visible = true
	isTouching = true
end)
v.MouseLeave:Connect(function()
	selectBox.Visible = false
	isTouching = false
end)

I know about ZIndex but how can i do the condition without comparing zindex?

I’m still a little confused, why would you need two frames if you just need one to detect zones?

Oh ok, i creating a windows system. I use the frame system for moving the window, but the problem is that the window hidden by the top one he’s moving even if isn’t visible. If all things is good, the second window must be the only to move. I use frame for the selection instead of button.

Oh I see, you could instead just use a direct window detection, let me quickly make a example script to explain.

1 Like

Alright so basically, I’ve made a quick example, where I don’t use MouseEnter and just directly from the UI element.

You’re basically going to use UserInputService but the ones built into the UI elements.

Here is a quick example that you can insert into StarterGui to showcase what I’m talking about.

Example Notes.rbxm (6.9 KB)

1 Like

Thanks you! You have resolved my main problem!

1 Like

You’re welcome, if you have any questions, be sure to let me know so I can answer them.

Just a question, i can view if the mouse enter or not because there are just mouse movement,touch etc… ?
This script is the mouse enter detector

v.UISBegin.OnServerEvent:Connect(function(plr,input)
			print(input.UserInputType)
			if not rptNo and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
				...

You could use the MouseEnter feature still, but might not be accurate if another frame is ontop.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.