The code works fine until the maps gets clone into workspace, Im trying to pick a killer and teleport him to a part and the others will go to another spawn or part this is what I have so far
--By TheTopBoss
local serverStorage = game:GetService("ServerStorage")
local maps = serverStorage.Maps:GetChildren()
h = Instance.new("Hint", game.Workspace)
while true do
if game.Players.NumPlayers >= 2 then
--Choosing Map
h.Text = "Game Will Start"
ranMap = math.random(1, #maps)
mapChosen = maps[ranMap]
h.Text = "Map Chosen : ".. mapChosen.Name
wait(3)
mapChosenClone = mapChosen:Clone()
mapChosenClone.Parent = game.Workspace
wait(3)
--Teleporting Players
while true do
wait(5)
contestants = {}
for _, player in pairs(game.Players:GetPlayers()) do
if player and player.Character then
local humanoid = player.Character:WaitForChild("Humanoid")
if humanoid and humanoid.Health > 0 then
table.insert(contestants, player)
end
end
end
end
if #contestants >= 2 then
break
else
end
while true do
wait(1)
RandomValue = math.random(1, #contestants)
wait()
RandomPlayerName = contestants[RandomValue]
wait()
h.Text = RandomPlayerName.." has been chosen as the killer!"
wait(4)
h.Text = "Teleporting all players to the map..."
RandomPlayer = game.Players:FindFirstChild(RandomPlayerName)
if RandomPlayer then
RandomPlayer.Character.Torso.CFrame = CFrame.new(-1942.5, 311.89, 29.5)
wait(5)
for i, v in pairs(game.Players:GetPlayers()) do
if v.Name ~= RandomPlayer.Name then
v.Character.Torso.CFrame = CFrame.new(-2173.6, 316.69, 211.6)
wait()
end
end
end
end
-- Time Before Game ends
for i = 10, 1, -1 do
h.Text = "Time left : " .. i
wait(1)
end
h.Text = "Game has ended"
wait(3)
mapChosenClone:Destroy()
--Intermission time
for i = 30, 1, -1 do
h.Text = "Intermission : " .. i
wait(1)
end
else h.Text = "More Players are needed"
end
wait()
end

8 comments
Tbh, everything looks correct.
ikr idk why it doest work
On line 24 you have a loop whitch will never end
I broke that loop if the players in the game are more than 2
Your check to break the loop is not actually located inside the loop you're trying to break.
from like 24 - 35 there is no break so the loop will not stop
How Can I fix this, I tried but didnt work
Nvm thanks for the help guys I worked on it for hours and figured it out