I stumbled upon a strange error. I have not found a solution to this problem on the Internet. maybe you can help?
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local lobby = game.Workspace.Spawn
local maps = ReplicatedStorage.Maps:GetChildren()
local status = ReplicatedStorage.Status
local duelteam = game.Teams.Duelists
local lobbyteam = game.Teams.Lobby
while true do
local players = Players:GetPlayers()
players.Team = lobbyteam
if #players >= 2 then
for i = 5, 0, -1 do
status.Value = "Intermission:" .. i
wait(1)
end
local chosenmap = maps[math.random(1, #maps)]
local clonemap = chosenmap:Clone()
clonemap.Parent = workspace
status.Value = "Map:" .. clonemap.Name
wait(2.5)
local chosenplayer1 = players[math.random(1, #players)]
local chosenplayer2 = nil
repeat
wait()
chosenplayer2 = players[math.random(1, #players)]
until chosenplayer2 ~= chosenplayer1
chosenplayer1.Character:SetPrimaryPartCFrame(clonemap.Teleport1.CFrame)
chosenplayer1.Team = duelteam
chosenplayer2.Character:SetPrimaryPartCFrame(clonemap.Teleport2.CFrame)
chosenplayer2.Team = duelteam
chosenplayer1.Character:WaitForChild("Humanoid").Died:Connect(function()
chosenplayer1.Team = lobbyteam
end)
chosenplayer2.Character:WaitForChild("Humanoid").Died:Connect(function()
chosenplayer2.Team = lobbyteam
end)
for i = 10, 0, -1 do
status.Value = "Liquidation:" .. i
local playing = {}
for i, plr in pairs(chosenplayer1:GetChildren()) do
if plr.Team.Name == "Duelists" then
table.insert(playing, plr.Name)
end
end
for i, plr in pairs(chosenplayer2:GetChildren()) do
if plr.Team.Name == "Duelists" then
table.insert(playing, plr.Name)
end
end
if #playing == 0 then
status.Value = "The duelists died"
wait(3)
break
end
if #playing == 1 then
status.Value = playing[1].Name.."Has WON!"
wait(3)
break
end
wait(1)
if i == 0 then
local sound = game.ReplicatedStorage["kid fav blinker"]
sound:Play()
wait(0.7)
chosenplayer1.Character.Humanoid.Health = 0
chosenplayer2.Character.Humanoid.Health = 0
status.Value = "Explosive draw!"
wait(3)
end
end
clonemap:Destroy()
chosenplayer1.Character:SetPrimaryPartCFrame(lobby.Tp1.CFrame)
chosenplayer1.Team = lobbyteam
chosenplayer2.Character:SetPrimaryPartCFrame(lobby.Tp2.CFrame)
chosenplayer2.Team = lobbyteam
else
status.Value = "You're unlikely to play alone."
wait(0.5)
status.Value = "You're unlikely to play alone.."
wait(0.5)
status.Value = "You're unlikely to play alone..."
wait(0.5)
end
end