So my main goal is to load in a custom character rig in StarterPlayer and to keep the Body Colors value from the original players character meaning the old body colors will go into the starter character. I want this to replicate with the server so this is what I have done so far.
local Players = game:GetService("Players") Players.PlayerAdded:Connect(function(player) local appearanceModel = game.Players:GetCharacterAppearanceAsync(player.UserId) appearanceModel["Body Colors"]:Clone().Parent = player.Character end)
Note: the custom player is in game.StarterPlayer and its named "StarterCharacter"
Use :LoadCharacter()
, which is a function of the Player object which you also get from the PlayerAdded event. This loads the character with the 'StarterCharacter' model you give them in StarterPlayer.
This would go before you parent the Body Colors to the Character since you need the Character to exist first.
local Players = game:GetService("Players") Players.PlayerAdded:Connect(function(player) player:LoadCharacter() local originalCharacter = Players:GetCharacterAppearanceAsync(player.UserId) local originalColors = originalCharacter:FindFirstChild("Body Colors") local newColors = original:Clone() charColors.Parent = player.Character end)
Note that you also have CharacterAppearanceLoaded
to help you further extend makes custom characters using their current loaded appearance.
Like the code above that loads a model, there's also GetCharacterAppearanceInfoAsync
that gives you their appearance info in dictionary format.
References:
Found the issue! I had the script disabled and inside of startercharacter scripts rendering it useless and I updated the code a bit. For anybody referencing off of this for their own games here is the script:
local Players = game:GetService("Players") Players.PlayerAdded:Connect(function(player) local appearanceModel = game.Players:GetCharacterAppearanceAsync(player.UserId) local bodyColors = appearanceModel:FindFirstChildOfClass("BodyColors"):Clone() bodyColors.Parent = workspace[player.Name] end)
The script is also inside of ServerScriptService and HTTPrequests is on.