A problem with the function GetModel , please, help me

I use this code:

local model = self.player:GetModel();

if (model == “models/player/vortigaunt.mdl”) then
self.player:GiveSpawnWeapon(player, “swep_vortigaunt_beam”);

But when I try to verify if the model is correct or not, it doesn’t work and I get this error on the console: attempt to call method ‘GetModel’ (a nil value)(Hook: PlayerSpawn).

Please, somebody can help me?

Thanks for all.

self.player is most likely nil lets see the full code

Here you are:

Thanks for help.

[lua]local model = player:GetModel();[/lua]
Most likely

Yea, this was the problem. Thank you!