Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
1

How to change the player’s character?

Asked by 2 months ago
Edited 2 months ago

Hey devs! In the game I’m currently creating, I’m facing a issue with the player’s character who’s wearing a package. I don’t want people to wear any package since when I transform them into a vampire they keep their package and it can’t be remove since it’s in the MeshPart ID which can’t be remove with a script so I told myself that I’ll morph the character. So keeping it short, how to give a new character to a player ? Without just removing the package setting in the game option since not everybody will be vampire so they can keep their package, only the vampire won’t be able to not have any.

Player.Character = newCharacter

don't correctly work. (No animation)

0
Because you then need to tell the client to setup this new character in the local script. kingdom5 5274 — 2mo
0
load animation, load controls in ect... kingdom5 5274 — 2mo

1 answer

Log in to vote
2
Answered by
upVector 802 Moderation Voter
2 months ago
Edited 2 months ago

In your Explorer, under StarterPlayer, you can insert a character model with the name that is exactly called "StarterCharacter" so that when a player joins, his/her character will be overridden to look exactly like the character model you assigned it to be.

Now, this method will make all your players' characters look the same. I'm assuming you don't want that. You'd still want the players to wear all of their accessories, shirts, t-shirts, and pants that they've customized their characters to wear. If that's the case, you can make use of the GetCharacterAppearanceAsync() function of the Players service to retrieve all that information and parent them to the player's character.

It would look something like this (in a server-sided script):

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        local appearance = game.Players:GetCharacterAppearanceAsync(player.UserId)
        for _, v in pairs(appearance:GetChildren()) do
            v.Parent = character
        end
    end)
end)
0
helpful ty starmaq 435 — 2mo
Ad

Answer this question