Button.Activated acting up?

I’m having issues where I have a button over a TextBox, and when you click said button, it should empty the search. However, when I click it, nothing happens. Neither of the below connections fire either when I click the button. However, if I double click, then both connections fire (activated, then Text changed)

The button has all default properties, so I don’t know why I’m having to double click itezgif.com-gif-maker (3)

Contents.Top.Search:GetPropertyChangedSignal("Text"):Connect(UpdateSearch)
Contents.Top.Search.Cancel.Activated:Connect(CancelSearch)

Im thinking from the two lines you have there its telling the script to cancel, but after canceling it updates the text → UpdateSearch is this wrong?

Nah, I have a print in both functions, and neither prints. So even though the mouse icon changes to show I can click on it, clicking does nothing, the connection is never fired. I have to double click to cause the event to happen for some reason

Oh okay. Cancel is a text button right? i am trying to setup a sample so I can figure it out

Ye
image


I just tried doing InputBegan on the close button, and it only picked up when my mouse hovers over it. Not any clicking. And also tried doing Search.Focused, and that only printed when I clicked on the search box, so its not overriding the button either

lmao I got the same issue, but I fixed it by changing the TextButton Zindex to 2 ( probably varies a bit depending on where stuff is )

TextBox Zindex = 1
TextButon Zindex = 2

local TextBox = script.Parent.TextBox
local TXTbutton = TextBox.TextButton

TXTbutton.Activated:Connect(function()
	print("Clicked")
end)

function UpdateSearch()
	print("UPDATE")
end

TextBox:GetPropertyChangedSignal("Text"):Connect(UpdateSearch)

^^ my script

Hope that works

Ye, my TextButton has a ZIndex of 6, while TextBox is 5, so the TextButton is above

Oh It didnt work? hm I dunno I guess i mess around with the UI a bit more.

Whats your Zindex type in the ScreenGUI

although it may not help can we just see your functions, it would be best to have as much info as possible. You could also try using MouseButton1Click.

Okay I think I found a solution to the problem, but ima need confirmation. I was noticing that whenever I was typing in the text box I couldnt click the text button, so I tried adding a new function to release focus

local TextBox = script.Parent.TextBox
local TXTbutton = TextBox.TextButton

TXTbutton.Activated:Connect(function()
	print("Clicked")
end)

TXTbutton.MouseEnter:Connect(function()
	TextBox:ReleaseFocus()
end)

function UpdateSearch()
	print("UPDATE")
end

TextBox:GetPropertyChangedSignal("Text"):Connect(UpdateSearch)

Its working really well I tried double checking as much as I could.

( see mouse enter )

2 Likes