Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i make so pepole pepole get 4 random weapons from the catalog everytime they spawns?

Asked by
viison -5
10 years ago

How do i make so pepole pepole get 4 random weapons from the catalog everytime they spawns?

0
at least 1 viison -5 — 10y

1 answer

Log in to vote
0
Answered by
gskw 1046 Moderation Voter
10 years ago

You will need to make a table of all the IDs of the weapons on the catalog, which might be a hard work. Then just put this inside a global script:

game.Players.PlayerAdded:connect(function(p)
    p.CharacterAdded:connect(function(a)
        local v=p
        for i=1,4 do
            local rnd=math.random(1,#ids) -- ids must be the weapon ID table
            game:service("InsertService"):LoadAsset(ids[rnd]).Parent=v.Backpack
        end
    end)
end
Ad

Answer this question