How do I use Humanoid Description to save players character

How do I use Humanoid Description to save players characters data

1 Like

Well you can’t save a players character data with Humanoid Descriptions. What you can do is use a Datastore.

You would most likely have to save a table containing all of the Humanoid Descriptions properties.

1 Like

You cannot use Humanoid Description to save data, use Datastores to save data

Ok but I was searching the devhub but found nothing I dont want to save players money I want to save like there body color, hair, eyes etc.

Datastore can save anything. Datastores are used for data like a user’s money, yes, but you can also be used to store the player’s body color, hair, eyes, etc.

Ok but how do I save the players character then (like a script)

Here if you want to learn more about datastores.

(Note, this didn’t work for me but I’m pretty sure cause I’m in studio.)

Here’s a script that save’s the player’s face when they join. Should give you an idea of how to use datastores.

local DataStoreService = game:GetService("DataStoreService")
local FaceDataStore = DataStoreService:GetDataStore("FaceDataStore")

game:GetService("Players").PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Wait()
	
	local Folder = Instance.new("Folder", Player)
	Folder.Name = "Stats"
	
	local Value = Instance.new("StringValue", Folder)
	Value.Value = Player.Character:WaitForChild("Head"):FindFirstChild("face").Texture
	
	local Key = Player.UserId .."_key"
	local Success, CurrentFaceSave = pcall(function()
		return FaceDataStore:GetAsync(Key)
	end)
	
	if Success then
		print("Successfully found player's save.")
		Player.Character:WaitForChild("Head"):FindFirstChild("face").Texture = CurrentFaceSave
	end
end)

game:GetService("Players").PlayerRemoving:Connect(function(Player)
	local Key = Player.UserId .."_key"
	
	local Success, Err = pcall(function()
		FaceDataStore:SetAsync(Key, Player["Stats"]["Value"].Value)
	end)
	
	if Success then
		print("Successfully saved ".. Player.Name .."'s face!")
	end
end)

Ok thank you :grinning: :grinning:

Ok but how does this script saves body colors

Note, that storing this in a data store is a bad idea.

If the player ever changes their avatar, your game wont update, so unless thats what you want ( a representation of the players avatar at a point in time) you should be using Players:GetHumanoidDescriptionFromUserId() instead. You don’t have to go through the mess of storing it, it’ll update when a player changes their avatar, and is probably faster anyway.