So my attempt at balanced picking is a bit buggy, with the Function IncreaseWeights it doesn't really work, it doesn't spit out any errors it adds 2 weight to one person and none to others, weird bug, any help would mean a lot!
function PickPlayer()
HighestWeight = 0
for _,player in pairs(game.Players:GetChildren()) do
local weight = player.Stuff.Weight
if weight and weight.Value > HighestWeight then
HighestWeight = weight.Value
Pick = weight
ChosenPlayer = Pick.Parent.Parent
IncreaseWeights(Pick.Parent.Parent)
end
end
return ChosenPlayer
end
function IncreaseWeights(Chosen)
for _,v in pairs(game.Players:GetChildren()) do
if v.Name ~= Chosen.Name then
if v.Stuff:findFirstChild("Weight") then
if v.Stuff.x2Weight.Value == false then
v.Stuff.Weight.Value = v.Stuff.Weight.Value + 1
elseif v.Stuff.x2Weight.Value == true then
v.Stuff.Weight.Value = v.Stuff.Weight.Value + 1.5
end
end
elseif v.Name == Chosen.Name then
if v.Stuff:findFirstChild("Weight") then
v.Stuff.Weight.Value = 0
end
end
end
end |