I need a data store that has three tables in it. I have this so far. I don't know how to make it so that it saved tables.

local DATA = game:GetService("DataStoreService"):GetDataStore("SaveNames");

game.Players.PlayerAdded:connect(function(player)
	local blocks = Instance.new("Folder", player)
	local names = Instance.new("StringValue", blocks)
	local positions = Instance.new("IntValue", blocks)
	local sizes = Instance.new("IntValue", blocks)
	blocks.Name = "Blocks"
	names.Name = "Names"
	positions.Name = "Positions"
	sizes.Name = "Sizes"
	if DATA:GetAsync(player.userId) then
		names.Value = DATA:GetAsync(player.userId)[1]
		positions.Value = DATA:GetAsync(player.userId)[2]
		sizes.Value = DATA:GetAsync(player.userId)[3]
	end
end)

game.Players.PlayerRemoving:connect(function(player)if player:FindFirstChild("Blocks") then
		DATA:GetAsync(player.userId, {player.Blocks.Names.Value, player.Blocks.Positions.Value, player.Blocks.Sizes.Value})
	end
end)

7 comments

0

This aint a request site

0

Its a help site and I need help..

0

The point of SH is not to provide free scripts - which whatever way you put it, is exactly what you are asking for - but to provide help with existing code or a question with 'special permission' to be codeless.

0

You should try making a DataStore yourself, then show us the code you are having trouble with if you encounter a problem.

0

Ok ill post the datastore I have rn

0

You can use :JSONEncode to turn a table into a string, then :JSONDecode to turn it back into a table.

0

So put it into a string to save it and then put it into a table to use it?