_G.Snipers = {z} local status = workspace.Values.Status function begin() workspace.Values.Snipers.Value = true workspace.Values.Intermission.Value = false local plr = game.Players:GetPlayers() for i,v in pairs (plr)do table.insert(_G.Snipers,v.Name) -- Only inserts one player into the table??? WHYY print(v.Name..' is _G.Snipers') local char = v.Character local human = char:WaitForChild('Humanoid') if char and human then workspace.Values.Status.Value = 'The next gamemode is Snipers!' wait(5) char:WaitForChild'Torso'.CFrame = CFrame.new(workspace.Spawn.Position) -- Teleport to arena status.Value = 'Based off the original "Quick Scoping", this game mode everyone faces off with a sniper to be the last one standing ' wait(5) status.Value = 'Giving every player their sniper...' game:GetService('ReplicatedStorage').Tools.Sniper:Clone().Parent = v:WaitForChild('Backpack') end wait(3) for i = 100,0,-1 do wait(1) status.Value = 'Kill every player and be the last one standing to win!' if #_G.Snipers == 1 then for i,winner in pairs (_G.Snipers) do if game.Players:FindFirstChild(winner) then --Finding the winner if winner ~= nil then status.Value = winner..' is the winner of the round and has recieved 100 CREDZ' game:GetService('ReplicatedStorage').Bank:WaitForChild(winner).Value = game:GetService('ReplicatedStorage').Bank:WaitForChild(winner).Value + 100 workspace:FindFirstChild(winner).Humanoid.Health = 0 _G.Snipers = {} -- Reset Table wait(3) workspace.Values.Round.Value = false workspace.Values.Intermission.Value =true workspace.Values.Snipers.Value = false script:remove() break end end end end break end end end begin()
I named where it errored but for some reason everytime it runs, it adds one player to the table, does anyone know what i did wrong?
Function Called before More Players have joined, add
repeat wait() until game.Players.NumPlayers>=MinPlayers
At the start of the Begin function and call Begin() again at the end to loop it.