The minigame script i'm using doesn't give an error, but it doesn't teleport players. The game keeps running even though it doesn't teleport players though. I have a brick named "Spawn" in the chosen map. It teleports players around lines 24-37.
h = game.ServerStorage:FindFirstChild("Text") players = game.Players:GetPlayers() while wait(1) do for intermissiontime = 10, 0, -1 do h.Value = intermissiontime .. " seconds until the round starts!" wait(1) end h.Value = "Choosing a random map..." local maps = game.ServerStorage["Maps"]:GetChildren() wait(3) repeat map = maps[math.random(1, #maps)] until map.Name ~= oldmap h.Value = "The chosen map is " .. map.Name .. " by " .. map.Creator.Value .. "!" mapclone = map:Clone() mapclone.Parent = game.Workspace wait(3) for waittime = 5, 0, -1 do h.Value = "Teleporting players in " .. waittime .. "..." wait(1) end p = 3 for i = 1, #players do if players[i].playing.Value == 1 then players[i].Alive.Value = 1 local Tel1 = mapclone:FindFirstChild("Spawn") players[i].Character.Humanoid.WalkSpeed = 0 players[i].PlayerGui.Shop.TextButton.Visible = false players[i].PlayerGui.Shop.TextButton.Active = false players[i].PlayerGui.Shop.Shop.Visible = false players[i].PlayerGui.Shop.Shop.Active = false players[i].PlayerGui.Playing.TextButton.Active = false players[i].PlayerGui.Playing.TextButton.Visible = false players[i].Character.Torso.CFrame = CFrame.new(Tel1.Position + Vector3.new(0, i * 5, 0)) end end wait(3) h.Value = "All players have 1 minute to finish. Go!" wait(1) for i = 1, #players do players[i].Character.Humanoid.WalkSpeed = 16 if players[i].extraspeed.Value == 1 then players[i].extraspeed.Value = 0 players[i].Character.Humanoid.WalkSpeed = 26 end if players[i].highjump.Value == 1 then players[i].highjump.Value = 0 local bod = Instance.new("BodyForce") bod.force = Vector3.new(0, 1500, 0) bod.Parent = players[i].Character.Torso end end roundtime = 60 dead = 0 roundEnded = false while wait(1) and roundtime > 0 do for j = 1, #players do if players[j].Character.Humanoid.Health <= 0 and players[j].Alive.Value == 1 then players[j].Alive.Value = 0 dead = dead + 1 if dead >= players.NumPlayers then roundEnded = true dead = 0 roundtime = 0 end end end h.Value = "You have " .. roundtime .. " seconds left!" roundtime = roundtime - 1 end oldmap = mapclone.Name mapclone:Destroy() if roundEnded == true then wait(3) h.Value = "Everyone died..." wait(5) end for i = 1, #players do players[i].Character.Humanoid.WalkSpeed = 16 bod = players[i].Character.Torso:FindFirstChild("BodyForce") if bod ~= nil then players[i].Charcter.Torso:FindFirstChild("BodyForce"):Destroy() end players[i].PlayerGui.Shop.TextButton.Visible = true players[i].PlayerGui.Shop.TextButton.Active = true players[i].PlayerGui.Playing.TextButton.Active = true players[i].PlayerGui.Playing.TextButton.Visible = true if players[i].won.Value == 1 then players[i].leaderstats.Wins.Value = players[i].leaderstats.Wins.Value + 1 if players[i].leaderstats.Rank.Value == "Bronze" then creditsWon = 10 elseif players[i].leaderstats.Rank.Value == "Iron" then creditsWon = 15 elseif players[i].leaderstats.Rank.Value == "Silver" then creditsWon = 20 elseif players[i].leaderstats.Rank.Value == "Gold" then creditsWon = 25 elseif players[i].leaderstats.Rank.Value == "Platinum" then creditsWon = 30 end if players[i].leaderstats.Wins.Value == 25 then players[i].leaderstats.Rank.Value = "Iron" elseif players[i].leaderstats.Wins.Value == 50 then players[i].leaderstats.Rank.Value = "Silver" elseif players[i].leaderstats.Wins.Value == 75 then players[i].leaderstats.Rank.Value = "Gold" elseif players[i].leaderstats.Wins.Value == 100 then players[i].leaderstats.Rank.Value="Platinum" end players[i].leaderstats.Credits.Value = players[i].leaderstats.Credits.Value + creditsWon players[i].won.Value = 0 end end end
You can just use MoveTo(), that way you won't need to worry about adding studs on the y axis.
for i, v in pairs(game.Players:GetPlayers()) do -- you can't have the GetPlayers up there, since that only runs when the server starts, and won't update when players join. Iterating is a more efficient way of doing this. if v.playing.Value == 1 then v.Alive.Value = 1 local Tel1 = mapclone:FindFirstChild("Spawn") v.Character.Humanoid.WalkSpeed = 0 v.PlayerGui.Shop.TextButton.Visible = false v.PlayerGui.Shop.TextButton.Active = false v.PlayerGui.Shop.Shop.Visible = false v.PlayerGui.Shop.Shop.Active = false v.PlayerGui.Playing.TextButton.Active = false v.PlayerGui.Playing.TextButton.Visible = false v.Character:MoveTo(Tel1.Position) end end
That should work.
I don't think you only have one spawn location, if you have more than one spawn location, you will need to iterate through all the bricks named "Spawn", and teleport the player to a random spawn.
Hope it helps!