This is my teleportation script, it's suppose to wait until a TextLabel changes, then teleport the player to the map, then wait until it changes again, then teleport them back. This script literally worked 10 minutes ago, and it just decided to not work now.
game.Players.PlayerAdded:Connect(function(player)
while true do
local Tab = {CFrame.new(-907, 5.4, -307); CFrame.new(-708, 73.4, -338); CFrame.new(-719, 73.4, -243); CFrame.new(-696, 55.4, -288); CFrame.new(-747, 6, -279); CFrame.new(-650, 5, -294); CFrame.new(-712, 8.6, -193); CFrame.new(-903, 5, -425); CFrame.new(-902, 8.6, -176); CFrame.new(-679, 55.4, -366); CFrame.new(-768, 60.2, -394); CFrame.new(-673, 38.6, -373); CFrame.new(-726, 38.6, -253); CFrame.new(-727, 55.4, -330)}
local locationselected = Tab[math.random(1, #Tab)]
local Spawnplates = {CFrame.new(19.511, 18.27, -42.511); CFrame.new(-31.86, 18.069, -18.085); CFrame.new(36.297, 19.375, -23.067); CFrame.new(-23.937, 18.17, -34.292); CFrame.new(-7.526, 18.27, -45.252); CFrame.new(-31.86, 18.069, -18.085); CFrame.new(37.096, 18.471, 9.724); CFrame.new(-35.261, 18.471, 2.364); CFrame.new(19.511, 18.27, -42.511)}
local spawnselected = Spawnplates[math.random(1, #Spawnplates)]
if player.PlayerGui.statusbar:WaitForChild("TextLabel").Changed then -- Error Might be here
game.Workspace:WaitForChild(player.Name).Head.CFrame = locationselected
if player.PlayerGui.statusbar:WaitForChild("TextLabel").Changed then -- Error might be here
game.Workspace:WaitForChild(player.Name).Head.CFrame = spawnselected
wait()
end
end
end
end)

1 comment
Indent your code please.