Save player's customized character after death/respawn

I have created a system where the player joins, they see a loading screen for a few seconds and then after that a character customization gui pops up and they can customize their character, and press complete and go around and play with it. I’ve got all this down but I have no clue how to make it so that when the player respawns, they have the character that they customized and not the default one.

Here is a piece of my code, in a local script inside of StarterPlayerScripts

repeat
	wait(2)
until game:IsLoaded() == true

local char = game.Workspace:WaitForChild(player.Name)
local hum = char:WaitForChild("Humanoid")

local function teleportPlayer(newPosition)
	if hum then
		hum.Parent.HumanoidRootPart.CFrame = CFrame.new(newPosition)
	end
end

walkspeed = hum.WalkSpeed

hum.WalkSpeed = 0

rs.Cutscenes.Play.Event:Connect(function()
	
	print(char.Name)
	
	if char:FindFirstChild("HumanoidRootPart") then
		char.HumanoidRootPart.CFrame = game.Workspace.CharacterCustomize.CharacterCustomizeSpawn.CFrame + Vector3.new(0,3,0)
	end
	
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = CF:WaitForChild('MaleCam').CFrame
	
	player.PlayerGui.CharacterCustom.Frame.Visible = true

	UI.Event:Connect(function(Button, currentPage)
		
		

		if Button == "Finish" then
			
			
			game.StarterPlayer:FindFirstChild("StarterCharacter"):Destroy()
			local newsc = game.Workspace:FindFirstChild(char.Name)
			newsc.Archivable = true
			local NEWStarter = newsc:Clone()
			newsc.Archivable = false
			NEWStarter.Parent = game:GetService("StarterPlayer")
			NEWStarter.Name = "StarterCharacter"
			
			print("Character Customized!")
			
			FadeIn()

sorry for the lengthy video, just skim through and you will be able to see what I am talking about

you could use values to save it, im not sure if you want it to be the same everytime they join too though, you would use datastores for that

1 Like

When I did this, I would usually keep the default player in the game, and would save the customized values.

When the player’s character would be added, I would just customize the default character they spawned with, giving it the customized values that I saved previously from the player’s input.

1 Like

Oh okay i see what you mean, would i do an object value? or like a string value that has whatever the player selected on it?

I’m definitely going to try this, plus this would make data store so much easier

Since all of the hair and the body colors that you have can be cycled through, you could save the number/id of each element that the player can customize.

When it comes to saving it on the server, if you want to permanently save the customized appearance, then you could just save it through datastore. Object values can work, but note that they will be temporary and will be deleted when the player leaves the game.

Those saved values can then load their appearance when the character is added.

1 Like

this works perfect! thank you so much!

1 Like