Hello, I tried making a concommand, which gives the targeted players all weapons as a test(autocomplete working fine), but when it comes to p:Give() it returns a error.
Here’s the function I use:
concommand.Add("cstranded_givealltools", function(ply, cmd, args) local target = args for _, p in pairs(player.GetAll()) do if p:Nick() == target then for _, w in pairs(GMS.AllWeapons) do p:Give(w) end end end end, customstranded.autocompletenames)
And here is the error:
[ERROR] addons/gmstranded_custom/lua/autorun/sv_concommands.lua:53: attempt to call method 'Give' (a nil value) 1. unknown - addons/gmstranded_custom/lua/autorun/sv_concommands.lua:53 2. unknown - lua/includes/modules/concommand.lua:54
I dont know how to fix that, a note also is, when I print out “w” using PrintMessage, it puts everything on one line, not like with player.GetAll() where it puts linebreaks, maybe thats the cause? if yes, I dont know how to fix that…