Making a character customization in a world and then saving it so when the player makes his character it gets saved over to a new game

How would I go on about making a character customization in a world and then saving it so when the player makes his character it gets saved over to a new game

I’ve been looking around the devforum and online and the closest thing I could find is the script down below (Which did not work)

local DataStoreService = game:GetService("DataStoreService")
local playerDataStore = DataStoreService:GetDataStore("PlayerData")

local function saveCharacter(player)
    local character = player.Character
    if character then
        local humanoidDescription = character.Humanoid:GetAppliedDescription()
        playerDataStore:SetAsync(player.UserId, humanoidDescription)
    end
end

local function onPlayerAdded(player)
    player.CharacterAdded:Connect(function(character)
        character.Humanoid.Died:Connect(function()
            saveCharacter(player)
        end)
    end)
end

Players.PlayerAdded:Connect(onPlayerAdded)
local DataStoreService = game:GetService("DataStoreService")
local playerDataStore = DataStoreService:GetDataStore("PlayerData")

local function loadCharacter(player)
    local success, humanoidDescription = pcall(function()
        return playerDataStore:GetAsync(player.UserId)
    end)

    if success and humanoidDescription then
        player.CharacterAppearanceLoaded:Connect(function(character)
            character.Humanoid:ApplyDescription(humanoidDescription)
        end)
    end
end

local function onPlayerAdded(player)
    loadCharacter(player)
end

Players.PlayerAdded:Connect(onPlayerAdded)```
1 Like