Prevent mouse events from going through UI to TextBox

Updated the video. Should be working now.

You didnt understand collectly. I want to prevent input from going to TextBox through frame. So if I click on frame, TextBox should not gain focus.

Maybe he means so that the text doesn’t go below the red box frame?

When I click on the Frame (red square), the TextBox (white rectangle) should not goin focus.

set the frame property “Active” to true

that should fix it

Edit: Just tested it in the same screen gui and it didnt work, so put the frame and text box in different screen guis

2 Likes

I’ve tried that, but this property determines whether a GuiObject will sink input to 3D space.

set the textbox property “selectable” to false

This is working, but if the TextBox was focused before I click the frame, it remains focused.
Edit: I found a solution for this.

That property is for gamepads.

This property determines whether a GuiObject will sink input to 3D space.

then i suppose there is no other way you can do this

I already found a solution with @Cryptic0Crystalized’s tip. I made so when the mouse enter frame, text box releases focus. Its not perfect, but its working.

well yea but it causes some ping/memory issues as well as there are many scripts running at the same time but anyways your choice

I made it using 1 script. chars

what if more frames like this come the total might go to 5+

You dont have to make script for each.

i know that

Instead of preventing the event just return out of the event’s connected callback function immediately.

local button = script.Parent

button.MouseEnter:Connect(function()
	return
end)

I call the TextBox:ReleaseFocus() function when mouse enters frame. You probably misunderstood what I wanted to do.