Im trying to make a round system
The teleporting isnt working for some reason.
Local script –
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