So, The datastore saves "Money" and "abillity" but not "swordtype" and I cant figure out why. Its in serverscriptservice take a look at the script:
local DSService = game:GetService('DataStoreService'):GetDataStore('Envoked420')
game.Players.PlayerAdded:connect(function(plr)
-- Define variables
local uniquekey = 'id-'..plr.userId
local leaderstats = Instance.new('Folder', plr)
local Money = Instance.new('IntValue')
local abillity = Instance.new("StringValue")
local swordtype = Instance.new("IntValue")
leaderstats.Name = 'leaderstats'
Money.Parent = leaderstats
Money.Name = 'Money'
swordtype.Parent = leaderstats
swordtype.Name = 'SwordType'
abillity.Parent = leaderstats
abillity.Name = 'Abillity'
-- GetAsync
local GetSaved = DSService:GetAsync(uniquekey)
if GetSaved then
Money.Value = GetSaved[1]
abillity.Value = GetSaved[2]
swordtype.Value = GetSaved[3]
else
local NumbersForSaving = {Money.Value,abillity.Value,swordtype.Value}
DSService:SetAsync(uniquekey, NumbersForSaving)
end
end)
game.Players.PlayerRemoving:connect(function(plr)
local uniquekey = 'id-'..plr.userId
local Savetable = {plr.leaderstats.Money.Value, plr.leaderstats.Abillity.Value, plr.leaderstats.SwordType.Value}
DSService:SetAsync(uniquekey, Savetable)
end)

1 comment
This is alvinbloxx's script. Make your own script.