- I successfully step through this method to grant joining players gears.
- But I'm guessing the rest of character loading is replacing the backpack, so the player never gets the gear
- What's the proper way to run scripts after the basic player backpack setup is done?
local dataSource = require(game.ServerScriptService.BehaviorLogic)
function playerJoined(player)
local gear = dataSource["GetInfo"](player, "GetGear")
SetupGear(player, gear)
end
local ins = game:GetService("InsertService")
function SetupGear(player, gear)
--wait(5) uncommenting this line makes it work
for _, assetId in ipairs(gear) do
print("Granting"..tostring(assetId))
local tool = ins:LoadAsset(assetId):GetChildren()[1]
print(tool)
tool.Parent = player.Backpack
end
end
game.Players.PlayerAdded:Connect(playerJoined)
