[SOLVED] How to change skin?

Hello,

I try to change the skin to the player but it does not work, yet I have the impression that the code is good and I do not see the error, could someone help me?

function ChangeToSkin(skin)
    local model = GetHashKey(skinName)
    RequestModel(model)
    while not HasModelLoaded(model) do -- Wait for model to load
      RequestModel(model)
      Citizen.Wait(0)
    end
    SetPlayerModel(PlayerId(), model)
    SetModelAsNoLongerNeeded(model)
end

Thanks you

The code is correct, be sure to set “skinName” correctly.

1 Like

OK i try :zipper_mouth:

    local model = GetHashKey(skinName)```

should be
```function ChangeToSkin(skin)
    local model = GetHashKey(skin)```
2 Likes

As @KennethDev has pointed out, your variables are named differently.

1 Like

Oh my god … I’m really sorry …

Thanks