Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to cache Roblox catalog gear?

Hello, I'm trying to make a Roblox game that references gear from the catalog without adding every single gear into my game into storage.

Is there any way to accomplish this?

If so, can you give some sort of function or something?

Thank you!

2 comments

0

Do you mean like listing multiple Gear to the UI?

0

I'm thinking of getting a random gear from the catalog, but I'm not trying to sound like I'm making a script request.

1 answer

✓ Accepted answer

I've wanted to do something similar before, the best approach I came up with was compiling a complete list of gear ids and putting them in a table so that i could spawn a random gear from that list. The list below is incomplete but just an example as to the setup. The script below would be used to give the player a random gear when they chat "r".

gears = {99797357, 99797381, 99797403, 99797327, 94794774, 99641902, 99610601, 99119158, 99119198, 97161241, 99254437, 99254358, 99119261, 99254241, 99119240, 83021197, 99254203, 99254164, 92142841, 87361662, 99130630, 99033296, 98411393, 98411436, 98970218, 98341183, 98253651, 98411325, 98253626, 98253592, 98346415, 13745494, 98253569, 98219158, 97932897, 97885552, 97885508, 97885572, 97885289, 97886188, 97756645, 97712291, 97311482, 97161262, 97161295, 96669943, 96669687}

function onMsg(msg, ply)
 if msg == "r" then
for i = 0,10 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

game.Players.PlayerAdded:connect(function(ply)
    ply.Chatted:connect(function(msg) onMsg(msg, ply) end)
end)

for _,ply in pairs(game.Players:GetPlayers()) do
    ply.Chatted:connect(function(msg) onMsg(msg, ply) end)
end

2 comments

0

Thanks, I'll try to work that into my script.

0

How could I change this script so instead of it giving you gear when you chat "r", it'll just give them when you spawn?

This discussion is preserved as it was. New answers, comments, and votes are closed.