So I have a teleportation script, that isn't working. What it's suppose to do is wait until a TextLabel changes, then teleport a player to a map. Then wait until the Label changes again, then teleport them back. This works occasionally. Some times if I mess with the script, like delete it then paste it back in, it works. Until I update the game again, and it's broke. Can someone please review my script, and see if It is the script causing this fault, or Roblox?
(Sorry If it doesn't appear Indented, It's 2 really long lists /:) Script:
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
game.Workspace:WaitForChild(player.Name).Head.CFrame = locationselected -- I think error might be here
if player.PlayerGui.statusbar:WaitForChild("TextLabel").Changed then
game.Workspace:WaitForChild(player.Name).Head.CFrame = spawnselected -- Or Here
wait()
end
end
end
end)
