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

How do i save more then value with datastore?

local DSService = game:GetService('DataStoreService'):GetDataStore('lolidk6969219')
game.Players.PlayerAdded:connect(function(plr)
	local uniquekey = 'id'..plr.userId
	local stuff = Instance.new("Folder", plr)
	stuff.Name = 'stuff'
	local Invun = Instance.new('IntValue', stuff)
    Invun.Name = 'Stat1'
    Invun.Value = 1
    local str = Instance.new('IntValue', stuff)  --2nd thing i wanna save
    str.Name = 'Stat2'
    str.Value = 1


	
	local GetSaved = DSService:GetAsync(uniquekey)
	if GetSaved then
		Invun.Value = GetSaved[1]  --i tried adding the 2nd thing here
	else
		local NumbersForSaving = {Invun.Value}  --here
		DSService:SetAsync(uniquekey, NumbersForSaving)
		
	end
end)

game.Players.PlayerRemoving:connect(function(plr)
	local uniquekey = 'id'..plr.userId
	local Savetable = {plr.stuff.Stat1.Value} --and in here but it just seems to have the same value as invun?
	DSService:SetAsync(uniquekey, Savetable)
	
	
	
end)

1 answer

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