Sword not a valid member items

So im trying to make an equip system and it works but whenever i start equipping other items it errors, saying sword is not a valid member of items.


remotes.Equip.OnServerEvent:Connect(function(player, item, ItemType, condition)

	if condition == "Equipped" then
	if ItemType == "Weapon" then
	   for index, equippedItems in pairs(player.Backpack:GetChildren()) do
			equippedItems:Destroy()
			end
			for index, onPlayer in pairs(player.Character:GetChildren()) do
			if onPlayer:IsA("Tool") then
					onPlayer:Destroy()
				end
			end
			
			local selecteditem = game:GetService("ServerStorage").Items[item]
			selecteditem.Parent = player.Character
end)

I think you’re forgetting to make a clone to parent from the looks of it, you get the item to parent but directly parenting it instead of making a clone

local selecteditem = game:GetService("ServerStorage").Items[item]
selecteditem:Clone().Parent = player.Character
1 Like