I attempted to give it a try, but so far no luck. I was wondering if I could hop on scriptinghelpers and maybe get some help. Heres my script:
lastnamepercentages = {
{Name = "Name1", Percentage = 0.5},
{Name = "Name2", Percentage = 0.5},
{Name = "Name3", Percentage = 0.3},
{Name = "Name4", Percentage = 0.3},
{Name = "Name5", Percentage = 0.2},
}
function lastnamepercentages:RandomObject()
local randomize = math.random();
local pastPercentage = 0;
for i = 1, #self do
if randomize < self[i].Percentage + pastPercentage then
return self[i];
end
pastPercentage = pastPercentage + self[i].Percentage;
end
end
plr.PlayerAdded:Connect(function(plr)
local randomClan = lastnamepercentages:RandomObject()
print(randomClan)
end)

1 comment
I don't understand what this is supposed to do, sorry if it's an inconvenience, but do you mind elaborating more?