im still a starter at scripting so I use tutorials but I can't find how to change the math on this script so it makes 2/3 of players in the game "bloxxers"
bloxxer = contestants [math.random(1, #contestants) ]
I just need help on how to make the math calculate 2/3 of players into "bloxxers"
Really easy, to get the number of 2/3 of players, you can simply use
local numofbloxxers = (#game.Players:GetPlayers() / 3) --[[gets 1/3 of players]] * 2 --multiplies the number of 1/3 of players to get 2/3 of players.
Now, to make all ppl bloxxers, do this.
local bloxxers = {} for i = 1, numofbloxxers do table.insert(bloxxers, game.Players:GetPlayers()[i]) end --do something with bloxxers table
Sorry that since I am on mobile, I cannot indent.
This SHOULD work. Haven't tested. Don't call it the 'best' method. I'm not the 'best' scripter either.
local Bloxers = {} local PlrNum = 0 for i, v (game.Players:GetChildren()) do -- Loop through all objects where players are stored if v:IsA("Player") then -- Make sure object is a player PlrNum = PlrNum + 1 -- Count players end end local BloxerCount = math.floor((PlrNum / 3) * 2) -- Get bloxer ammount local Count = 0 local A = game.Players:GetChildren() while Count < BloxerCount do -- Repeat for every bloxer needed local TempPlr = A[math.random(1, #A)] -- Chose random player for i,v in ipairs(Bloxers) do if A ~= v then -- Make sure player isn't allready a bloxer table.insert(Bloxers, A) -- Add player to list Count = Count + 1 end end end