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?
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)