How would I make a player have a different character if they have a gamepass?

How would I make a player have a different character if they own a gamepass?
I know I could do

if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, id) then

But how would I change the player’s character if it returns true? Currently, I already have a character model in StarterPlayer. I’ve tried searching it up but I couldn’t find any relevant results. All help is appreciated :slight_smile:

1 Like

How I go about making players using other characters, is to clear all accessories and clothes from their avatar. Store the character model of something you would like to set them to in something like ReplicatedStorage. Clone any accessories and clothes from your stored character model. Use Humanoid:AddAccesory(Accessory) for accessories, and parent anything else (clothing, bodycolors or anything else you might want) into their character model.

Is there a easy way to change an entire model? I have the avatar in Replicated storage.

This is probably the easiest way involving the least effort. If you need help writing the script I’m more than happy to help.

You could use HumanoidDescription to do that.
Also, I suggest using pcalls to wrap the gamepass ownership checks.

I believe you can do

game:GetService("Players").LocalPlayer.Character = "Instance of character, 
i would recommend cloning it and using that instance"

If you want to do that i believe you have to make the players CameraSubject the humanoid of the character. If you want help on anything else hmu :]

And you can do this for any character really, and it should change the entire character.

OH and one last thing, change the player’s character to the humanoid of the character you want. And if you want to change the model’s name to the player’s name you have to do it before you run that line of code. Sorry if everything is jumbled up.

How could the code mentioned in the post have an error, though?

Also, how would I wrap around pcall?

Do not do this, as this will not work.

Sorry im new, im not too advanced.

You can wrap something in a pcall like so.

local success, error = pcall(function()
    -- Code inside here will not stop your script if it produces an error.
end)

if (not success) then
    warn(error)
end