Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why will this Data Store script not work?

According to the ROBLOX Wiki: Data Stores can save tables.

I tried that, once saving and loading. The first code should save the table, and the second code should load the table.

local tabledatastore = game:GetService("DataStoreService"):GetDataStore(player.Name.."Knives")
	tabledatastore:SetAsync("Table",{	player.Cardboard.Value, --LINE 7
										player["Cup of Tea"].Value,
										player["Diamond Camo"].Value,
										player["Murderer Knife"].Value,
										player["Neon Green"].Value,
										player.Paper.Value,
										player["Purple Galaxy"].Value,
										player["Rainbow Zebra"].Value,
										player.Waffle.Value,
										player["Woodland Camo"]})

Output error: 15:46:58.298 - Cannot store Array in DataStore 15:46:58.299 - Script 'Workspace.SaveLeaderboard', Line 7 15:46:58.299 - Stack End

LOADING

DSS = game:GetService("DataStoreService"):GetDataStore(player.Name.."Knives")
	knifetable = DSS:GetAsync("Table")
		if knifetable[1] then --LINE 77
			player.Cardboard.Value = true
			Num.Value = Num.Value+1
		else
			print("Cardboard false")
		end

Output error: 15:46:50.117 - Workspace.SaveLeaderboard:77: attempt to index global 'knifetable' (a nil value) 15:46:50.118 - Stack Begin 15:46:50.119 - Script 'Workspace.SaveLeaderboard', Line 77 15:46:50.120 - Stack End

1 answer

When using datastores, you cannot store objects. Sorry :(

2 comments

0

I'm not storing an object..

0

"player["Woodland Camo"]" is an object, no?

This discussion is preserved as it was. New answers, comments, and votes are closed.