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

Data Store help.. Please?

I have problem with Loading and Saving..

Loading Problem: This is most likely a syntax error.

DSS = game:GetService("DataStoreService"):GetDataStore(player.Name.."Knives")
	knifetable = DSS:GetAsync("Table")
	print(knifetable..player.Name.." Line79")
	if knifetable == nil then knifetable = {false,false,false,false,false,false,false,false,false,false}end
	print(knifetable..player.Name.." Line 81")

Output Error:

17:39:10.766 - Workspace.SaveLeaderboard:79: attempt to concatenate global 'knifetable' (a nil value) 17:39:10.767 - Stack Begin 17:39:10.767 - Script 'Workspace.SaveLeaderboard', Line 79 17:39:10.768 - Stack End

Saving Problem: I want to save a table, with boolean values. There are 10 BoolValue instances in each player. I want to save their values:

game.Players.PlayerRemoving:connect(function(player)
	local tabledatastore = game:GetService("DataStoreService"):GetDataStore(player.Name.."Knives")
	tabledatastore:SetAsync("Table",{	player.Cardboard.Value, --This is 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:

17:39:43.706 - Cannot store Array in DataStore 17:39:43.706 - Script 'Workspace.SaveLeaderboard', Line 7 17:39:43.707 - Stack End

1 answer

  • You cannot save instances into a datastore ("Player['WoodlandCamo']" - Line 12)
  • On your first script, you try to print the value of "knifedata" (Line 3), where the value is nil and it is erroring.

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