Is it possible to override a connected RBXScriptSignal?

Is there a way to essentially “override” an RBXScriptSignal? For example, I have a TextBox and I’m setting the value of that textbox automatically but the user can also provide input into it. I need to listen for when the text is changed by the player but not when the text is set automatically by my code. I couldn’t find any information on this.

Is this possible and if not does anyone have any solutions? The only one I could come up with is disconnecting the event when the value is changed by the system then recreating & connecting it once the change is completed but that feels extremely inefficient.

Just use maids at this point

1 Like
local isGameModifyingText = false

box:GetPropertyChangedSignal("Text"):Connect(function()
    if not isGameModifyingText then
        -- do what it normally does
    end
end)

local function changeBoxText(newText)
    isGameModifyingText = true
    box.Text = newText
    isGameModifyingText = false
end

This is probably the easiest way to do it. Create a boolean to determine if the game is modifying the textbox.

1 Like

Yep this is actually the method I went with I just created a debounce in my TextField class.