Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

How to change the player’s character?

Asked by 5 years ago
Edited 5 years 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. User#5423 17 — 5y
0
load animation, load controls in ect... User#5423 17 — 5y

1 answer

Log in to vote
2
Answered by
nilVector 812 Moderation Voter
5 years ago
Edited 5 years 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 1290 — 5y
Ad

Answer this question