Round System is not working

Im trying to make a round system
The teleporting isnt working for some reason.

Local script –

image

local RoundTime = 40
local Intermission = 15
local TextButton = script.Parent
local plrs = game.Players:GetChildren()
local Players = game:GetService("Players")


while true do
	local roundTime = RoundTime
	local intermission = Intermission

	while intermission > 0 do
		TextButton.Text = "Round Staring In: " .. intermission
		wait(1)
		intermission = intermission - 1	
	end

	TextButton.Text = "Round Starting"
	wait(3)
	game.ReplicatedStorage.TpGame:FireServer()
	wait(3)
	game.Workspace.Map1.THEpart.Transparency = 1 
	game.Workspace.Map1.THEpart.CanCollide = false

	while roundTime > 0 do
		TextButton.Text = "Time Remaining: " .. roundTime
		wait(1)
		roundTime = roundTime - 1	
	end

	TextButton.Text = "Round Ending"
	wait(0.2)
	game.Workspace.Map1.THEpart.Transparency = 0
	game.Workspace.Map1.THEpart.CanCollide = true

	game.ReplicatedStorage.TpLobby:FireServer()
	wait(1)
end

Teleport script (ServerScriptService)

local plrs = game.Players:GetChildren()

game.ReplicatedStorage.TpGame.OnServerEvent:Connect(function()
	for i = 1, #plrs do
		local num = math.random(1, 8)
		plrs[i].Character.Head.CFrame = CFrame.new(workspace.Teleporters["Part"..num].Position)
	end
end)

-------------------------------------------

game.ReplicatedStorage.TpLobby.OnServerEvent:Connect(function()
	for i = 1, #plrs do
		local num = math.random(1, 8)
		plrs[i].Character.Head.CFrame = CFrame.new(workspace.LobbyTeleporters["Part"..num].Position)
	end
end)

Everything works but players wont teleport im dont know why

I don’t see why you don’t just start out with handling almost the entire thing on the server and avoid firing to the server needlessly

Aside from that consider moving the root part instead of the head and potentially adding a vector 3 y value (you need to experiment if you need it), and remove cframe.new just move the player == to the existing cframe

player.Character.HumanoidRootPart.CFrame = workspace.Teleporters["Part"..num].CFrame + Vector3.new(0,1,0)
3 Likes