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

My DataStore isn't working but it gives no error. Can someone help? thanks.

Hey kids. this is a predicament. someone help pls thx.

ds = game:GetService("DataStoreService"):GetDataStore("RM")

game.Players.PlayerAdded:connect(function(player)
	local key = "id-" .. player.userId
	local gs = ds:GetAsync(key)
	tbl = {}
	local gui = player.PlayerGui:WaitForChild("Inventory")
	local frame = gui:WaitForChild("Inventry")
	local list1 = frame:WaitForChild("list"):WaitForChild("1")
	table.insert(tbl, list1.Image.Texture.Value)
	table.insert(tbl, list1.Item.Text)
	table.insert(tbl, list1.Qty.qty.Value)
	-- I have 3 table.inserts only because it gave me an error when I put all these in one ok
	if gs then
		tbl[1] = gs[1]
		tbl[2] = gs[2]
		tbl[3] = gs[3]
	else
		ds:SetAsync(key, tbl)
	end
end)

game.Players.PlayerRemoving:connect(function(player)
	local key = "id-" .. player.userId
	ds:SetAsync(key, tbl)
end)

1 answer

Uh only think i can think of is that your trying to get tbl when tbl is in playeradded function so its returning a error cause it cant find it?

1 comment

0

it's not local.

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