ply:SetModel() not working?

I try to but when it executes the code the player models dont change…

Post your code, and are there any errors?

Make sure you’re setting the model before the player entity spawns.

Code and logs (if you’re getting console errors) would be helpful if that isn’t the case.

I’m having this problem aswell.

[lua]
function GM:PlayerLoadout( ply )
ply:SetModel( “models/player/kleiner.mdl” )
end
[/lua]
seems to have no effect.

What file are you putting it in, are you running it server side, and are there any console errors.

In init.lua, try this instead:



function GM:PlayerInitialSpawn( ply ) 
 
    ply:SetModel( "models/player/kleiner.mdl" )
 
end 

[lua]function GM:PlayerSpawn(ply)

ply:SetModel( player_manager.TranslatePlayerModel( GetConVarString( "cl_playermodel" ) ) )
    ....[/lua]

Lets player RESPAWN with their set model :slight_smile:

This Should work fine:

[lua]

util.PrecacheModel( “models/player/odessa.mdl” )
function GM:PlayerSetModel( ply )
ply:SetModel( “models/player/odessa.mdl” )
end

hook.Add(“PlayerSpawn”, “SetModel”, function(ply)
GAMEMODE:PlayerSetModel( ply )
end)

[/lua]

[lua]

util.PrecacheModel( “models/player/odessa.mdl” )
function GM:PlayerSetModel( ply )
ply:SetModel( “models/player/odessa.mdl” )
end

hook.Add(“PlayerSpawn”, “SetModel”, function(ply)
GAMEMODE:PlayerSetModel( ply )
end)

[/lua]

Curious, would this all go together in the init.lua file?

Yes