Hi.
Im currently working on a Weapon Dealer and in the code snippet I will share here, I have a table “result” where all weapon names (Strings) are in the player owns. In rep.Weapons are all existing Weapons. I want to achieve, that all weapons in “result” should copy into the players backpack. But when I try to clone the weapon out of rep.Weapons and set the parent, I become the error which is in the title.
Its a script inside ServerScriptService. Heres the code:
for i, v in pairs(result) do
for s, w in pairs(rep.Weapons:GetChildren()) do
if v == w.Name then
local tool = w:Clone()
print(tool.ClassName, w ,v)
tool = w.Name
tool.Parent = plr.Backpack
end
end
end