Why won't this work?

Hello. I’ve made a code based on feedback from another thread that supposedly gets rid of something really annoying for deathmatch-oriented modifications of gmod’s bot system(the bots added through the concommand “bot”). Basically, what I’ve been trying to get rid of is the way that bots always stop moving whenever they’re hurt. I wanted to fix it in a GarrysMod/garrysmod/lua/autorun file I made:

Here’s the code:


function PlayerHasHurtABot(ply)
if ply:IsBot() then
timer.Create( "PleaseWork", 0, 0, function(ply)
ply:SetVelocity( (ply:GetAimVector() * 250 ) )
end)
end
end
hook.Add( "PlayerHurt", "BotHasBeenHurtHopeThisWorks", PlayerHasHurtABot )


Why isn’t it working? I keep getting this error upon hurting a bot:



[ERROR] lua/autorun/dumb_fighting_bots.lua:5: attempt to index local 'ply' (a nil value)
  1. unknown - lua/autorun/dumb_fighting_bots.lua:5

Timer Failed! [PleaseWork][@lua/autorun/dumb_fighting_bots.lua (line 4)]


[LUA]
function PlayerHasHurtABot(ply)
if ply:IsBot() then
timer.Create( “PleaseWork”, 0, 0, function()
ply:SetVelocity( (ply:GetAimVector() * 250 ) )
end)
end
end
hook.Add( “PlayerHurt”, “BotHasBeenHurtHopeThisWorks”, PlayerHasHurtABot )
[/LUA]

you cant parse the ply var into the function it is automatic so you dont need to