function SaveData(character) local Data = {} local DaPlayer = Players:GetPlayerFromCharacter(character) character.Humanoid:UnequipTools() for i, v in pairs(DaPlayer.Backpack:GetChildren()) do if v:IsA("Tool") or v:IsA("LocalScript") then table.insert(Data, v.Name) print(v.Name) end end local UserId = "Player_"..DaPlayer.UserId local succ, err = pcall(function() DS:SetAsync(UserId, Data) end) if succ then print("Data Saved Sucessfully to"..DaPlayer.Name) else warn(err) print("Problem saving "..DaPlayer.Name.."'s Data") end end function teleport(Array) local ReserveCode = TS:ReserveServer(6981160086) TS:TeleportToPrivateServer(6981160086, ReserveCode, Array) end while wait() do for i, v in pairs(workspace:GetChildren()) do if v:FindFirstChild("Bending Sense") and v:FindFirstChild("MatchMaker") then table.insert(Potentials, v.Name) print("Added A Potential 1v1 Contester") end end if Potentials[2] ~= nil then print("Found Players to Teleport To Arena") local Chooser = math.random(1, #Potentials) local Character2Name = Potentials[Chooser] local Character2 = game.Workspace:FindFirstChild(Character2Name) repeat wait() local Chooser = math.random(1, #Potentials) Character1Name = Potentials[Chooser] until Character1Name ~= Character2Name local Character1 = game.Workspace:FindFirstChild(Character1Name) SaveData(Character1) SaveData(Character2) wait(3) --wait(100) Player1 = Players:GetPlayerFromCharacter(Character1) Player2 = Players:GetPlayerFromCharacter(Character2) local Array = {Player1, Player2} teleport(Array) Player2 = nil Player1 = nil Potentials = {} else Potentials = {} end end
use
while true do wait() --stuff here end
While wait() do does not work because you need a condition which returns true or false to either keep the look running or end it.