Hello
I have tried to change player character with the custom character with the following code
for i,v in pairs(game.workspace.GalaxySMediaXz:GetChildren()) do
if not v:IsA("Script") and not v:IsA("LocalScript") then
v:Destroy()
end
end
for i,v in pairs(game.CustomCharacter:GetChildren()) do
v:Clone().Parent = workspace.GalaxySMediaXz
end
it works but the animation does not work and the accessories have a bug too
So I want to know if there are better solutions
Thank! and sorry for bad English
EDIT: So I have tried different code and still doesn’t work
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAppearanceLoaded:Connect(function(character) --CharacterAdded works too but it occasionally errors, for me anyway.
for i,v in pairs(character:GetDescendants()) do
v:Destroy() --Include some lines to ensure that the torso and head don't get destroyed or else the player will die.
end
for i,v in pairs(game.CustomCharacter:GetChildren()) do
v:Clone().Parent = player.Character --Don't use the direct reference to the character via Workspace in case another model is named after it.
end
end)
end)
So this would run every time their current character loads, then we destroy it and replace it with the custom character. Your current code would only run once, and perhaps the player’s character has not loaded yet. There may be a better alternative, but this is what I would do anyway haha.