Help with round system

--Service 
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")
local ServScriptService = game:GetService("ServerScriptService")

--variables

local requiredPlayers = 1
local roundLength = 10
local intermissionLength = 10

local lobby = workspace.Lobby

local kameha = ServScriptService.Kameha
local statusText = ""
local statusUpdate = ReplicatedStorage.Remotes:WaitForChild("StatusUpdate")

local function waitForPlayers()
	statusText = "Waiting for players..."
	repeat
		task.wait(.5)
		statusUpdate:FireAllClients(statusText)
	until #players:GetPlayers() >= requiredPlayers
end

local function startRound()
	
	
end

local function endRound()

	
end

while true do
	
	-- intermission
	for i = intermissionLength, 0, -1 do
		
		statusText = "Waiting for next round... ("..tostring(i)..")"
		statusUpdate:FireAllClients(statusText)
		task.wait(1)
	end
	
	waitForPlayers()
	startRound()
	
	for i = roundLength, 0 , -1 do
		statusText = "Game running...("..tostring(i)..")"
		statusUpdate:FireAllClients(statusText)

		task.wait(1)
	end
	endRound()
end

I need that when the round ends the players teleported to the lobby, I can not understand how to do this because to local players and then to humanoidrootpart I can not access. I need you to help me teleport players to the lobby.

1 Like
local lobbyposition = Vector3.new(0,0,0)

for i,v in game.Players:GetPlayers() do
v:MoveTo(lobbyposition)
end
1 Like

When endRound() starts working, the script just ends and writes “Game running(0)”
image
image
.

1 Like

They made a small mistake in the loop. Instead, do this:

local lobbyposition = Vector3.new(0,0,0) -- change to lobby position (must be vector3)

for _, Player in game.Players:GetPlayers() do

     Player.Character:MoveTo(lobbyposition)
end
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.