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

[SOLVED] Easier way to see if the user has changed something in textbox?

So right now I have this:

code = script.Parent.Code.Value
error = script.Parent.Error.Visible

while true do
if script.Parent.Text == code then
teleportPlayer()
else
error = true
wait(5)
error = false
end
end

Having a loop constantly running is a little much I think, also my server gets laggy when I have too many loops constantly going soooo, how do I make this easier?

1 answer

✓ Accepted answer

Do this:

code = script.Parent.Code.Value
error = script.Parent.Error.Visible

code.Changed:connect(function()
if script.Parent.Text == code then
teleportPlayer()
else
error = true
wait(5)
error = false
end
end)

1 comment

1

Hope that helps.

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