The script does not teleport the players!

  1. What do you want to achieve? Teleporting all players when the timer reaches 1.

  2. What is the issue? I don’t know how to teleport the players in the map

  3. What solutions have you tried so far? Testing and fixing


local ChosenMap = Maps[math.random(1,#Maps)]:Clone()
   print(ChosenMap)
   ChosenMap.Parent = workspace
   for _, player in pairs(game.Players:GetChildren()) do
      local char = player.Character
      char.HumanoidRootPart.CFrame = workspace.CurrentMap.SpawnPlayersToMap
end

And the error is “CurrentMap” is not a valid member of workspace

You didn’t name the selected map current map from what I see

Yeah because random map is one of the four maps that is selected

You need to name it current map so that the script knows what current map is

Edit: or say chosen map instead

Like this?

 '''
         ChosenMap .Name = "Map"

‘’’

Or instead say when u set the CFrame

Chosen map.spawnplayerstomap

That’s what I would do

Yeah but the error is that that “ChosenMap” is not a valid member of workspace

In ur first statement u said that the error is current map isn’t a valid member of workspace

Im asking how would you make that randomly selected map a valid member of workspace?

Ohhh Ok I’m stupid lol

U need to say game.Workspace

U can’t just say workspace because the script needs to know where it is

Do this


local ChosenMap = Maps[math.random(1,#Maps)]:Clone()
   print(ChosenMap)
   ChosenMap.Parent = workspace
   for _, player in pairs(game.Players:GetChildren()) do
      local char = player.Character
      char.HumanoidRootPart.CFrame = ChosenMap.SpawnPlayersToMap
end

You never defined CurrentMap at all

Unfortunately, that doesn’t work.

That wouldn’t fix it either you can still use workspace and game.Workspace

Let me fix it give me a minute


local ChosenMap = Maps[math.random(1,#Maps)]:Clone()
print("Chosen Map: "..ChosenMap.Name)
ChosenMap.Parent = workspace
ChosenMap.Name = “LoadedMap”

for _, player in pairs(game.Players:GetChildren()) do
   local char = player.Character
   char.HumanoidRootPart.CFrame=game.Workspace:WaitForChild(“LoadedMap”).SpawnPlayersToMap
end
local ChosenMap = Maps[math.random(1,#Maps)]:Clone()
  
 print(ChosenMap)
   ChosenMap.Parent = workspace
   for _, player in pairs(game.Players:GetChildren()) do
      local char = player.Character
      char.HumanoidRootPart.CFrame = ChosenMap.SpawnPlayersToMap.CFrame
end

The thought here is that you should just call the map by the Variable referenced from when you cloned it

Also can you tell me if “SpawnPlayersToMap” is an object like a part or a model?

Its just a part (30 charsssssss)

What is SpawnPlayersToMap? A part or a group with spawns? If it’s a group with spawns:

local Spawns = workspace.CurrentMap.SpawnPlayersToMap:GetChildren()
local RandomSpawn = Spawns[math.random(#Spawns)]
char.HumanoidRootPart.CFrame = RandomSpawn.CFrame

If it’s a single part:

char.HumanoidRootPart.CFrame = workspace.CurrentMap.SpawnPlayersToMap.CFrame

You were trying to set HRP’s CFrame as a part, which is not possible, you forgot to put .CFrame

Also:

I hope this helps you :+1:

Hey it worked! (You forgot the CFrame of the spawn part. I added it) Thanks a lot!