Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why doesn't the changed event work when the TextButton changes text?

I was confident that using the Changed event would work, as when the text changes in the TextButton it triggers and it prints 'Hello'. This is a simple script, but I can't understand why it isn't working. (I'm making a player searching tool, I want to trigger the event of when the text is changed to figure out if the player is in the game or not)

Here is my code:

local text = ""
local player =game.Players

script.Parent.enterUsername.Changed:Connect(function()
	if game.Players:FindFirstChild(script.Parent.enterUsername.Text)then
		print("Hello")
	end
end)


1 answer

I'm guessing that you're trying to call a function when a textbox's text changed. You'd need to use GetPropertyChangedSignal:

local text = ""
local players = game.Players

script.Parent.enterUsername:GetPropertyChangedSignal("Text"):connect(function()
    if game.Players:FindFirstChild(script.Parent.enterUsername.Text)then
        print("Hello")
    end
end)

2 comments

0

Still not working, I'll test around with the event, however.

0

See what happens when you remove the if statement. Should print out hello whenever you type into the box. If it doesn't, make sure there are no errors in the output and enterUsername is actually the textbox that you are typing to. If that works, then try again with the if statement.

This discussion is preserved as it was. New answers, comments, and votes are closed.