I own a Murder Mystery style game, and we have rounds. What I would like this script to do, is teleport the player, to a map after a textlabel changes. Then after the round is done, it teleports the players back after the label changes again. But you see, It doesn't work. The text label changes, but I don't get teleported. This is a problem to say the least. I have tried adding waits, and the script originally referenced StarterGui, and i changed it to PlayerGui, which worked! But then, IT STOPPED WORKING ALL OF A SUDDEN. So if someone could please review my scripting and tell me if there's an issue, i'd be so happy. ;)
Sorry If it doesn't APPEAR indented, as it contains 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
if player.PlayerGui.statusbar:WaitForChild("TextLabel").Changed then
game.Workspace:WaitForChild(player.Name).Head.CFrame = spawnselected
wait()
end
end
end
end)
