[Sandbox] How to disable the random player model when you spawn

Hello everyone !

I have a little problem on my server. I want to disable the random playermodel when you spawn for the first time on the server. I tried to find how to do that but i’m lost.

It’s a problem because sometimes the player spawn with a vip model :confused: If you know how to disable it with a command or something, That would be great !

( I tried the command GM.Config.enforceplayermodel = true but it didn’t work )

Just hook player spawn and set their model there.

ot: wow first post in 11 years

Thank you for the answer but, I don’t know how to do that. Can you tell me what i need to write and where ?

Make a new file in lua/autorun/server and inside put the following.



local vipmodels = {"models/player/gman_high.mdl", "models/player/leet.mdl"}
local usermodels = {"models/player/artic.mdl", "models/player/phoenix.mdl"}

local function playermodelyo(ply)
if ply:IsUserGroup("vip") then
ply:SetModel(table.random(vipmodels))
else
ply:SetModel(table.random(usermodels))
end
end
hook.Add("PlayerSpawn", "playermodelyo", playermodelyo)


[ERROR] lua/autorun/server/randommodel.lua:8: attempt to call field ‘random’ (a nil value )

replace table.random with table.Random, uppercase R