Hello,

I have got a script in ServerScriptService and a local script in the PlayerGui. The server script saves and receives/gives information from/to the local script which tells the server if something has happened with the local parts that are cloned in.

My error is that when I save a table and load it, I can't loop through the table.

Saving in the server script:

Datastore:SetAsync(collectiblesID, playerDS)

and loading:

playerDS = Datastore:GetAsync(collectiblesID)

The variables are as follows:

local Datastore = game:GetService("DataStoreService"):GetDataStore("TestDataStore")
local storedData = {}
local collectiblesID = player.UserId.."-cc"
local playerDS = storedData[player.Name]

The main problem is, when looping through storedData using:

for a,b in pairs(storedData) do
	print(b)
	return b
end

instead of printing whatever b is meant to be (a 1-3 digit combination depending on the playr's progress), it simply prints "table: 38E35AE8" (the 38E35AE8 changes every time).

If I can receive any help on this, thank you.

1 comment

0

its because the value inside storedData is a table. can i see your table structure?