So I'm working on a game where every time a player spawns, I want them to spawn with a different set on randomized Gear. I've tried a couple different ways to make this happen, and thus far the best/closest thing I've found to work is magiccube3's script, but on hers, she makes it so every time a player chats "r" it'll give them the gear:
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 = 1,5 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
So my question is, how would I be able to change this script to make it so that, instead of having to type "r" to get the gear, players would spawn with a randomized backpack of gear (which also changes when the die and respawn)

3 comments
I appreciate the quick responce! I edited the script to fit what you showed but unfortunetly it isn't working, any other ideas?
Oh, nevermind! I figured it out. Thank you very much for your help!
Welcome, Make sure to accept the answer if it helped!