while true do ToMap = CFrame.new(-2, 20.5, -50) ToSpawn = CFrame.new(277.5, 1.5, -206.5) wait(10) for i, m1 in ipairs(game.Workspace.MapOne:GetChildren()) do m1.Transparency = 1 m1.CanCollid = false for i, player in ipairs(game.Players:GetChildren()) do if player.Character and player.Character:FindFirstChild("Torso") then player.Character.Torso.CFrame = ToMap + Vector3.new(0, i * 5, 0) player.TeamColor = game.Teams["Playing"].TeamColor m1.Transparency = 0 m1.CanCollide = true wait(10) m1.Transparency = 1 m1.CanCollide = false player.TeamColor = game.Teams["Lobby"].TeamColor player.Character.Torso.CFrame = ToSpawn + Vector3.new(0, i * 5, 0) end end end end
This script all works except for the m1, which the the map that I want to load in. The players get teleported in and out and their teams change accordingly, but the map won't load and unload. Can someone help me adjust this to fix it?
1: You are setting it invisible when you load it
2: (I am not sure if this is on purpose) You are making it invisible then visible then invisible for every player every 10 seconds.
(3: You are making it visible twice)
Fixed:
while true do ToMap = CFrame.new(-2, 20.5, -50) ToSpawn = CFrame.new(277.5, 1.5, -206.5) wait(10) for i, m1 in ipairs(game.Workspace.MapOne:GetChildren()) do m1.Transparency = 0 m1.CanCollide = true end for i, player in ipairs(game.Players:GetChildren()) do if player.Character and player.Character:FindFirstChild("Torso") then player.Character.Torso.CFrame = ToMap + Vector3.new(0, i * 5, 0) player.TeamColor = game.Teams["Playing"].TeamColor end end wait(10) for i, m1 in ipairs(game.Workspace.MapOne:GetChildren()) do m1.Transparency = 1 m1.CanCollide = false end for i, player in ipairs(game.Players:GetChildren()) do if player.Character and player.Character:FindFirstChild("Torso") then player.TeamColor = game.Teams["Lobby"].TeamColor player.Character.Torso.CFrame = ToSpawn + Vector3.new(0, i * 5, 0) end end