How Do I Change This To Where It Teleports Via Each Map And Not Randomly ?
I Want it to teleport to maps that are in my maps folder as right now it teleports to the spawns in the teleport folder and i want it to instead teleport to certain places instead of randomly. I Can say Map names if needed.
local rand = math.random(1, #maps)
local map = maps[rand]:Clone()
map.Parent = workspace
status.Value = "Map Chosen "..map.Name
wait(4)
local players = game.Players:GetChildren()
for i = 1,#players do
if players[i].Character ~= nil then
local spawnLocation = math.random(1,#workspace.Teleports:GetChildren())
players[i].Character:MoveTo(workspace.Teleports:GetChildren()[spawnLocation].Position)
players[i].Character.Parent = workspace.Ingame
end
end
Insert a folder/model called ‘SpawnPoints’ in each of your maps, and then :
local rand = math.random(1, #maps)
local map = maps[rand]:Clone()
map.Parent = workspace
status.Value = "Map Chosen "..map.Name
wait(4)
local players = game.Players:GetChildren()
for i = 1,#players do
if players[i].Character ~= nil then
local spawnLocation = math.random(1,#map.SpawnPoints:GetChildren())
players[i].Character:MoveTo(map.SpawnPoints:GetChildren()[spawnLocation].Position)
players[i].Character.Parent = workspace.Ingame
end
end
Will this teleport to the correct map thats on the status each time ?
So will it teleport to just the spawn points inside each map thats currently running ?