local codeData = game:GetService("DataStoreService"):GetDataStore("C")

game.Players.PlayerAdded:Connect(function(plr)
	local codeFolderNames = Instance.new("Folder", game.ServerStorage.Code)
	codeFolderNames.Name = plr.Name
	
	local key = plr.UserId
	
	local savedValues = codeData:GetAsync(key)
	
	local gotChildren = codeFolderNames:GetChildren()
	
	if savedValues then
		gotChildren = savedValues[1]
	end
end)

game.Players.PlayerRemoving:Connect(function(plr)
	local key = plr.UserId
	local whatToSave = game.ServerStorage.Code:FindFirstChild(plr.Name):GetChildren()
	codeData:SetAsync(key, whatToSave)
end)

that's the code i got so far, help?

2 comments

0

Explain what isn’t working

0

It doesn't put the objects back in the game when you play it again. Like for instance, a player inserted like a BoolValue into a folder, and basically I want it to save that object, so the player leaves (it saves) then when they join back that boolvalue is still there