Help me solve my problem

Hello guys, i’ve found script on your forum, which replace detective model (from default to custom). And i want to make it for innocent model, but i don’t know coding :<<<
Can someone help me?
P.S. I tried “IsActiveInnocent”, but it won’t work :frowning:



hook.Add("TTTBeginRound", "BeginRoundDetectiveSkin", function()
    for k,v in pairs(player.GetAll()) do
        if v:IsActiveDetective() then v:SetModel(Model("your_model.mdl")) end
    end
end)





hook.Add("TTTBeginRound", "BeginRoundDetectiveSkin", function()
    for k,v in pairs(player.GetAll()) do
        if v:GetRole() == ROLE_INNOCENT then v:SetModel(Model("your_model.mdl")) end
    end
end)



Untested, but is probably right.

You don’t want to make it for innocents because then you’d find out who the traitors are from models, so you’ll want to do it for everyone

If I recall, there’s a table in terrortown’s shared.lua in which you can modify what model everyone is randomly assigned, so check there

Thank you! It’s working.
Also thank you both for quick answer.

https://github.com/garrynewman/garrysmod/blob/64242f4ecd2d0f7d29e36caa4c1d727cb6ff00d9/garrysmod/gamemodes/terrortown/gamemode/player_ext_shd.lua

ply:IsActiveRole(ROLE_INNOCENT)