Saving accessories?

So what I want is for when the player equips a item lets say a hat

When they leave and rejoin it is still on there head

I have the equip system

But I dont know where to start for the saving system, I have checked so many places without an answer

Anyone know where to start?

You could use ProfileService for the data system for your game.

What you’ll need to do is essentially:
1- when a player equips a hat , you’ll need to add the hat’s name into the Data [make sure u know how to call and use ProfileService, there’re great tutorials out there].

2- make sure there’s an organized folder in ServerStorage where you have the actual accessories
[will be useful for the loading the equipped hats,etc].

3- when the player rejoins, you’ll need to get the saved hats from that folder in serverstorage and then put those hats on the player.

Profile service is definitely the best option, but if you don’t want have to learn how to use it, then you can just save a table in your SetAsync. Something like this:

local savedAccessories = {} -- you would just add to this table when a player equips/unequips an item

game:GetService("Players").PlayerRemoving:Connect(function()
    game:GetService("DataStoreService"):GetDataStore("ds name"):SetAsync(savedAccessories)
end)

this is my copy paste code

local DataStoreService = game:GetService("DataStoreService")
local Players = game:GetService("Players")

local AccessoriesData = DataStoreService:GetDataStore("Accessories")
local SavingData = 0

local function AddAccessory(Player, AccessoryName)
	-- adds accessory
end

local function GetPlayerAccessories(Player)
	--[[
	the name of the accessory, not the instance
	{
		"CatAccessory",
		"Blue glasses",
		"BlackAccessory"
	}
	
	]]
end

local function PlayerAdded(Player)
	local PlayerAccessories = AccessoriesData:GetAsync(
		`{Player.UserId}`
	) or {}
	
	for i, Accessory in PlayerAccessories do
		AddAccessory(Player, Accessory)
	end
end

for i, Player in Players:GetPlayers() do
	PlayerAdded(Player)
end
Players.PlayerAdded:Connect(PlayerAdded)

Players.PlayerRemoving:Connect(function(Player)
	local Accessories = GetPlayerAccessories(Player)
	SavingData += 1
	
	AccessoriesData:SetAsync(
		`{Player.UserId}`,
		Accessories
	)
	
	SavingData -= 1
end)

game:BindToClose(function()
	if SavingData > 0 then
		repeat task.wait()
		until SavingData == 0
	end
end)

Thanks for all the replys! I will look into them :smiley: