Need Help With Command

hello there i am working a command but it is haveing the following error

Timer Error: …odes\darkrp\entities\entities\sent_backpack\init.lua:217: attempt to index global ‘self’ (a nil value)

here is the code [lua] function withdraw(ply, args)
if args == “” then return “” end

if not tonumber(args) then
	return ""
local amount = math.floor(tonumber(args))

if amount <= 1 then
	Notify(ply, 1, 4, string.format(LANGUAGE.invalid_x, "argument", ""))
	return ""

if not ply:CanAfford(amount) then
	Notify(ply, 1, 4, string.format(LANGUAGE.cant_afford, ""))
	return ""

timer.Simple(1, function(ply) 
	if ValidEntity(ply) then
	local SpawnPos = self.Entity:GetPos() + self.Entity:GetForward() * -20
	SpawnPos.z = SpawnPos.z + 70
	DarkRPCreateMoneyBag(SpawnPos, amount)
end, ply)

return ""

AddChatCommand("/withdraw", withdraw)


all i whant it to do is creat that money bag without any problems could u help me out here plox …

thx for ur time

Where do you suppose self magically appears from?

ok fixed Thx