So in this game I'm working on, I have a script that randomly hands out 6 gear to a player, but sometimes it'll 2 or 3 of the same gear to a player, so they're left with three of the same gear and three other things to use (just an example). So my question is, using the script provided below, how would I limit it so that a player can only get one of each gear, so that theyre not ending up with more than one of the same gear?
gears = {1145081326, 1208300505, 34398938, 186867645, 10758456, 298087401, 243007180, 212296936, 116693764, 48596305, 72713855, 118281463, 107458483, 11999247, 11377306, 11563251, 115377964, 225921000, 90718505, 2103274863, 1180418251, 66426498, 566780253, 95951330, 846792499, 11999279, 972189904, 1046323916, 391005275, 928806888, 169602103, 78730532, 130112971, 1492225511, 208659586}
game.Players.PlayerAdded:connect(function(ply)
ply.CharacterAdded:Connect(function()
for i = 1,6 do
local model = game:GetService("InsertService"):LoadAsset(gears[math.random(#gears)])
for _,v in pairs(model:GetChildren()) do
if v:IsA("Tool") or v:IsA("HopperBin") then
v.Parent = ply.Backpack
end
end
end
end)
end)

1 comment
This worked! Thank you very much