MouseEnter and MouseLeave not functioning as expected

(Sorry if this happens to be the wrong category! It sorta involves GUIs, and i’ve never written a thread about them. Anyways, let’s get to the point!)

  1. What do i want to achieve? Make it so when the mouse hovers over my GUI, it can make it through the small gap inbetween my first frame and my second frame.

  2. What is the issue? Since i disable the second frame with MouseLeave to prevent two different frames from clipping, i can never make it across the gap. The video below shows that.

  3. What solutions have i tried so far? Extending the frames, but that ruined the design.

The script below is what i used. The script is stored inside a LocalScript object.

--Variables
local btn = script.Parent --Script's parent
local sub = btn.HiList --List of other similar words
--Main function
btn.MouseEnter:Connect(function() --When the mouse hovers over the script's parent
	sub.Visible = true --Make the list of similar words visible
end) --End this function

--Second function
btn.MouseLeave:Connect(function() --When the mouse hovers elsewhere
	sub.Visible = false --Make the list of similar words invisible
end) --End this function

Thanks in advance, Sprite.

You can send an image from the explorer to me to improve your script?

What do you want an image of?

The ScreenGui children to see how to make the script.

Okay.
ChildrenSC
The thing inside DNCheck is

--Repeats the check every 0.01 seconds
while wait(0.01) do
--Variables
local frm = script.Parent.Options --Options Frame
local prt = script.Parent --Script's Parent

	if frm.Visible == true then --If the Options Frame is visible then
		prt.Image = "http://www.roblox.com/asset/?id=7096112767" --Change the Parent's image to the "pressed down" image
	elseif frm.Visible == false then --Otherwise, if the OPtions Frame isn't visible then
		prt.Image = "http://www.roblox.com/asset/?id=7096111806" --Change the parent's image to the default image
	end --End the if statement
end --End the checking

The thing in FrameOpen is

--Variables
local btn = script.Parent
local frm = btn.Options
local function opn()
	frm.Visible = not frm.Visible
end

--Open/Close Frame
btn.MouseButton1Click:Connect(opn)

The thing in all of the SendBubble objects is

--Variables
local csv = game:GetService("Chat") --Gets the chat
local txt = script.Parent.Text --Variable for the text that will be sent
local btn = script.Parent --Script's parent

--Main function
btn.MouseButton1Click:Connect(function() --When someone clicks the button once
	csv:Chat(game.Players.LocalPlayer.Character.Head --[[The head of who clicked --]], txt --[[Text to be sent--]], Enum.ChatColor.White --[[Sends a white bubble--]])
end)

And inside all of the WhenHover objects is

--Variables
local btn = script.Parent --Script's parent
local sub = btn.InsertFrameNameHere --List of other similar words
--Main function
btn.MouseEnter:Connect(function() --When the mouse hovers over the script's parent
	sub.Visible = true --Make the list of similar words visible
end) --End this function

--Second function
btn.MouseLeave:Connect(function() --When the mouse hovers elsewhere
	sub.Visible = false --Make the list of similar words invisible
end) --End this function

Also, if you happen to need the .rbxl place file, here it is. SafeChatTest1.rbxl (30.7 KB)

I think a good solution for this would for to create an invisible frame, inside the area where you want the mouse to be when the tab is open.
Check for MouseLeave on that new invisible frame inside of the one you’re currently doing the check on.

The frame should be positioned like this:

I don’t quite understand what you mean by that, do I extend one frame?

No, create a new frame which will act as the arena for the mouse to be in. If the mouse leaves that frame, close the tab.
Make the frame transparency equal to 1.

You would have an invisible frame in the background which is the frame registering the MouseEnter and MouseLeave events, instead of either of those frames. They just display and have the buttons, while the invisible frame (don’t use the visible property otherwise the events won’t register! instead use Transparency = 1 as @RedstonePlayz09 mentioned.) is detecting for the mouse leaving and entering.

edit: sorry i responded to the wrong person

Something like this?352 Sem Título_20210728210859

Try this:

--Variables
local btn = script.Parent --Script's parent
local sub = btn.HiList --List of other similar words
--Main function
btn.MouseEnter:Connect(function() --When the mouse hovers over the script's parent
	sub.Visible = true --Make the list of similar words visible
end) --End this function

--Second function
sub.MouseLeave:Connect(function() -- After mouse left designated frame
	sub.Visible = false --Make the list of similar words invisible
end) --End this function

Explanation:
Since we want the player to be able to access the list of similar words, perhaps we should only close the frame after they hover away from it, not the button.

Ok. But where do I put this? The “arena” frame?

same place where you had it before :slight_smile:

I replaced the scripts, however, this happened.

The frame overlayed with the other one, and after i opened it again, it was still visible.
Also, i can’t get to the “third menu section”.

Bump. I really need help with this.

this is your solution though, from the code given, you have to iterate (for loop getchildren or get descendants) through the menu’s everytime on mousebuttonhover, set the ones not associated to the given menu to false, associated one to true (visibility property).

when mouseleave, set every menu visibility to false.

atleast thats what it seems to me.

So, the code is correct? Please elaborate further.