DarkRP Change team on death not working?

I would assume this would work
[lua]
function GM:PlayerDeath( ply )
if ply:Team() == TEAM_MAYOR then
ply:SetTeam( TEAM_CITIZEN )
print(“Works”)
end
end
[/lua]

But it didn’t :/, it prints “Works” in console, but it doesn’t change the team?

[editline]8th September 2013[/editline]

Nvm,
[lua]
hook.Add(“PlayerDeath”,“DemoteMayor”,function(ply)
if (ply:Team() == TEAM_MAYOR) then
ply:ChangeTeam(TEAM_CITIZEN,true);
for k, v in ipairs(player.GetAll()) do
v:PrintMessage(HUD_PRINTCENTER,“The current Mayor of the city has been Assassinated!”);
if v:Team() == TEAM_MAYORSPROTECTOR then
v:ChangeTeam(TEAM_CITIZEN,true);
end;
end;
end;
end);
[/lua]