When the player first spawns, I click a button which calls the following code, it works as expected until the player dies and respawn, the module function runs and EquipTool
is being called.
However, the tools are no longer being added to the player’s backpack.
I know that when you equip a tool it removes it from ReplicatedStorage, which is why I have cloned it.
function module:equipWeapons()
humanoid:UnequipTools()
player.Backpack:ClearAllChildren()
for _, weapon in weaponData do
local tool = ReplicatedStorage.Weapons[weapon.category][weapon.name].Tool[weapon.name]:Clone()
humanoid:EquipTool(tool)
end
end
Any help would be greatly appreciated.