This is the map loading script so far.
local rtarget = game.Workspace.RedTargetPosition--Name a brick "RedTargetPosition" where you want red Team to be sent to at begining. local btarget = game.Workspace.BlueTargetPosition--Name a brick "BlueTargetPosition" where you want blue Team to be sent to at begining. local target2 = game.Workspace.LobbyPosition --Name a brick "LobbyPosition" where you want them to be sent to at the end. print("Change Map Script Loaded") while true do wait(2) game.Lighting.Outpost:clone().Parent = game.Workspace wait(300) local msg = Instance.new("Message") msg.Parent = game.Workspace msg.Text = ("Changing Map...") wait(4) msg:remove() game.Workspace.Outpost:remove() wait(2) game.Lighting.Ravine:clone().Parent = game.Workspace wait(300) msg.Parent = game.Workspace msg.Text = ("Changing Map...") wait(4) msg:remove() game.Workspace.Ravine:remove() wait(1) end
Can I add this to the current code so that once a map is loaded, players will be teleported to their sides? If so, where would would I put this code.
for i,v in pairs (game.Players:GetPlayers()) do if v ~= nil and v.TeamColor.Name == "Bright red" then v.Character.Torso.CFrame = rtarget.CFrame + Vector3.new(0,i*15,0) elseif v ~= nil and v.TeamColor.Name == "Bright blue" then v.Character.Torso.CFrame = btarget.CFrame + Vector3.new(0,i*15,0) wait(.1) end print("Players teleported onto map") --Tells output they're on map wait(300) --10 minutes for i,z in pairs (game.Players:GetPlayers()) do if z ~= nil then z.Character.Torso.CFrame = target2.CFrame + Vector3.new(0,i*15,0) end end end end
You could create a global variable telling your script when the map is ready to spawn. If the map is being spawned then you set the global variable equal to false so that your other script knows that it can't teleport the players just yet. Then, when the G.V. is changed to true, it tells the script that it can teleport the players.
Ex.
_G.Ready = 0 --Not ready --The rest of your script is here _G.Ready = 1 --Ready
in your other script you can have a repeat loop that checks for when _G.Ready is equal to 1
repeat wait() until _G.Ready == 1