Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

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

Asked by 5 years ago
Edited 5 years ago

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

Log in to vote
3
Answered by 5 years ago

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
Hope that helps. titaneagle 0 — 5y
Ad

Answer this question