Teleporter not working?

But how would I do that? I am confused on that part

target = workspace["Spawn"..math.random(1,6)]
it’ll select a part in workspace starting with “Spawn” and then a random number from 1 to 6.
Spawn1, Spawn2, Spawn3, Spawn4, Spawn5, Spawn6
it’ll spread the players out to one of those.

for i, player in ipairs(game.Players:GetChildren()) do
  if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
   target = workspace["Spawn"..math.random(1,6)]
   player.Character.HumanoidRootPart.CFrame = target.CFrame
  end 
end

If you want it to teleport each player to a different spawn, then you can create a table of each spawn part object and teleport the player to a random object in the table and then remove the object from the table so that it can’t be teleported to again.

1 Like

I found something, when both the Intermission and Round are over, it just goes back to 0.

That’s because the round ended and you don’t have a system at the moment that restarts the round. I can’t do everything for you so after this please try your best to do things on your own.

But, to make a system that restarts the round, you can easily repeat the Start() function, as the code below it won’t execute until the loops end.

local function Start()
  for i = 10, 0, -1 do 
    IntermissionTime = i 
    game:GetService("ReplicatdStorage").IntermissionTime.Value = i 
    wait(1)
  end 
 -- The code below will teleport the players to the target as soon as the count finishes
  for i, player in pairs(game.Players:GetChildren()) do
    if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
    target = workspace["Spawn"..math.random(1,6)]
    player.Character.HumanoidRootPart.CFrame = target.CFrame
    end 
  end
  -- After all players are teleported, the round will start counting down 
  for i = 30, 0, -1 do 
    RoundTime = i
    game:getService("ReplicatedStorage").RoundTime.Value = i  
    wait(1)
  end 
end 

while true do 
  wait()
  Start()
  wait(10) -- replace 10 with the time between rounds 
end

Pretty sure that will work. This is no longer an issue with the teleportation as I’ve already solved that. Try your best to fix anything else on your own, and if it’s still an issue, create a new thread explaining the issue and what you tried to do to fix it.

Good luck! Hope I helped.

1 Like

Ok, I just have a question.

wouldn’t there be no point of that because of the intermission? or would that just crash the game?

Oh. Yeah, there’s no point of that. It wouldn’t crash the game because I already put a wait() at the start of the loop. Forgot about the intermission, my bad.

1 Like

Oh, thank you. That makes a lot of sense.

2 Likes