Ability icons sometimes not loading on Equip

I have a UI that lets the player choose their weapon. It spawns the equipment, then equips the player:

local equipment = World.SpawnAsset(MYEQUIPMENT, {position = SpawnLocation})
equipment:Equip(player)

But... when this happens, often the icons for the abilities associated with the equipment don't load completely (just the default ones show) when the weapon is equipped.

If I add a Task.Wait() with 1 or 2 seconds, after spawning and before equipping, it seems to fix the issue.

My questions is: I don't really like picking an arbitrary time like 1 second or 2 seconds, not knowing for sure if everything has loaded completely. Is there a function that is made specifically for this that checks if everything has loaded that I can use before equipping the player? -- Assuming that this is what's happening?

Whenever you grab objects from core object reference custom properties you will often have the code "WaiForObject()" at the end of the statement. This will halt your script until the object finishes loading.

So, if your equipment had a core object reference that refers to the ability you could do something like this:

(This is a client side script that will broadcast an event when the UI should be updated
this script needs to be in a client context and be a descendant of the equipment that is being spawned)

local equipment = script:FindAncestoryByType("Equipment")
--Halt the script until the ability finishes loading
local dummy_ability = equipment:GetCustomProperty("Ability"):WaitForObject()
--Ability should now be finished loading so broadcast an event telling you
--code to update the UI icons
 Events.Broadcast("Update UI Icons")

For comparison your original code would do something along the lines of this:

local equipment = script:FindAncestoryByType("Equipment")
--Halt the script for 2 seconds to give the ability time to finish loading
Task.Wait(2)
--Ability should now be finished loading so broadcast an event telling you
--code to update the UI icons
 Events.Broadcast("Update UI Icons")

Ok, I will try that. Thanks!