string expected, got Weapon

Hey all, I want to strip all the weapons from a player and then later give them back, every things works except the give weapons back. I have:
[lua]
for k, v in pairs(OldWeapons) do
ply:Give(v)
end
[/lua]

I get this error: bad argument #1 to ‘Give’ (string expected, got Weapon)
I don’t know how to fix, so any help would be lovely :3
Thanks!

[lua]ply:Give(v:GetClass())[/lua]

With that I get: Tried to use a NULL entity!
[lua]
OldWeapons = {}

for k, v in pairs(ply:GetWeapons()) do
table.insert(OldWeapons, v)
end
[/lua]

Thats how I store the weapons in the table if that can help :3

You should be storing them by their class.

[lua]local OldWeapons = {}

for _, v in ipairs(ply:GetWeapons()) do
table.insert(OldWeapons, v:GetClass())
end[/lua]

[lua]for _, v in ipairs(OldWeapons) do
ply:Give(v)
end[/lua]

Ahh, Thank you, that was very helpful :D!
And some fast answers :slight_smile: