Help changing player models per steam id

This is what I got from another thread

function GM:PlayerSetModel(ply)
    local mdl = GAMEMODE.playermodel or "models/player/phoenix.mdl";
    if ply:SteamID() == "STEAM_x:x:xxxxxxxx" then
        mdl = "models/player/alyx.mdl";

I went into garrysmod/gamemodes/terrortown/gamemodes/player.lua and i edited the file to include this (obviously putting my steam id instead of x’s) but it did not change my player model, I also at times got kicked for lua errors upon rounds ending (I was spectating when this first happened) but I was able to rejoin and play. Is this not the proper way to code this since the update to gmod 13? is that what is causing the issue?