local models = {
"models/player/odessa.mdl",
"models/player/alyx.mdl"
-- any so on...
}
hook.Add("PlayerSetModel", "RandomPlayerModel", function(ply)
-- Pick a random model based on the array's length
local random_model = models[math.random(#models)]
-- Assign the chosen model to the player
ply:SetModel(random_model)
end
(I am newbie)I have used this code. But it doesn't work at all. My script is in the gamemode folder and is called "serverscript.lua".Basically, I need the system to automatically change the model to a random one when the player enters the game.
I tried to fix this problem. But unfortunately only errors appeared that clung to "hook.ADD" and other syntax errors. There is absolutely no solution to this problem on the internet.
Here is an article about this class - https://wiki.facepunch.com/gmod/GM:PlayerSetModel