I have it making and saving a integer value inside a TextLabel inside a ScreenGui in the PlayerGui but it wont save it. Here's the code:
local DSService = game:GetService('DataStoreService'):GetDataStore('Hamburger223232')
game.Players.PlayerAdded:connect(function(plr)
-- Define variables
local uniquekey = 'id-'..plr.userId
local leaderstats = Instance.new('IntValue', plr)
local savevalue = Instance.new('IntValue')
savevalue.Parent = game.StarterGui.ScreenGui.TextLabel
savevalue.Name = 'Bounty'
-- GetAsync
local GetSaved = DSService:GetAsync(uniquekey)
if GetSaved then
savevalue.Value = GetSaved[1]
else
local NumbersForSaving = {savevalue.Value}
DSService:SetAsync(uniquekey, NumbersForSaving)
end
end)
game.Players.PlayerRemoving:connect(function(plr)
local uniquekey = 'id-'..plr.userId
local Savetable = {plr.PlayerGui.ScreenGui.TextLabel.Bounty.Value}
DSService:SetAsync(uniquekey, Savetable)
end)

1 comment
Are you testing it in studio??