i've been trying to fix this for the past 3 days, please help
-- Vars local ReplicatedStorage = game:GetService("ReplicatedStorage") local ServerStorage = game:GetService("ServerStorage") local MapsFolder = ServerStorage:WaitForChild("Maps") local Status = ReplicatedStorage:WaitForChild("Status") local GameLength = 180 -- Loop The Game If No One Wins while true do Status.Value = "2 players needed to start the game" repeat wait(1) until game.Players.NumPlayers >=2 Status.Value = "Intermission" wait(20) local plrs = {} for i, player in pairs(game.Players:GetPlayers()) do if player then table.insert(plrs,player)-- add players to table end end wait(2) local availableMaps = MapsFolder:GetChildren() local ChosenMap = availableMaps[math.random(1,#availableMaps)] Status.Value = ChosenMap.Name.." was picked" local ClonedMap = ChosenMap:Clone() ClonedMap.Parent = workspace --Tp players local SpawnPoint = ClonedMap:FindFirstChild("SpawnPoints") if not SpawnPoint then print("Spawnpoints is not found") end local AvailableSpawnPoint = SpawnPoint:GetChildren() for i, player in pairs(plrs) do if player then character = player.Character if character then -- tp character:FindFirstChild("Torso").CFrame = AvailableSpawnPoint[1] table.remove(AvailableSpawnPoint,1) --give a tool local Sword = ServerStorage.Sword.Clone() Sword.Parent = player.Backpack local GameTag = Instance.new("BoolValue") GameTag.Name = "GameTag" GameTag.Parent = player.Character else -- is no char if not player then table.remove(plrs,i) end end end end Status.Value = "Starting Game" wait(2) for i = GameLength,0,-1 do for x, player in pairs(plrs) do if player then character = player.Character if not character then -- left else if character:FindFirstChild("GameTag")then print(player.Name.."is still in the game") else -- they are deade table.remove(plrs,x) print(player.Name.."has been removed") end end end table.remove(plrs,x) print(player.Name.."has been removed") end Status.Value = i.." time left, and "..plrs.." Players left" if #plrs == 1 then Status.Value = plrs[1].Name.." has won the game." plrs[1].leaderstats.Coins.Value = plrs[1].leaderstats.Coins.Value + 200 break elseif #plrs == 0 then Status.Value = "Sadly, no one won" break elseif i == 0 then Status.Value = "Time's up lads'. Good luck next time" break end wait(1) end print("End of game") for i, player in pairs (game.Players:GetPlayers()) do character = player.Character if not character then --ignore else if character:FindFirstChild("GameTag") then character.GameTag:Destroy() end if player.Backpack:FindFirstChild("Sword") then player.Backpack.Sword:Destroy() end if character.Backpack:FindFirstChild("Sword") then character.Sword:Destroy() end end player:LoadCharacter() end ClonedMap:Destroy() Status.Value = "Game ended" wait(2) end
this script is from alvinblox, but i cant seem to find out how to fix it