So I'm getting an error saying
19:48:28.816 - ServerScriptService.Leaderboard:51: bad argument #3 to 'Value' (string expected, got boolean) 19:48:28.817 - Script 'ServerScriptService.Leaderboard', Line 51 19:48:28.817 - Stack End
The value's I'm trying to save are IntValue's and StringValue's
**Here's my script : **
-- ayy lmao
local DSService = game:GetService("DataStoreService"):GetDataStore("PlayerSaveData")
game.Players.PlayerAdded:connect(function(plr)
local uniquekey = "id-"..plr.userId
local m = Instance.new("Model", plr)
m.Name = "leaderstats"
local i = Instance.new("IntValue", m)
i.Name = "Cash"
local w = Instance.new("IntValue", m)
w.Name = "Wins"
local inb = Instance.new("BoolValue", plr)
inb.Name = "InBattle"
inb.Value = false
local GB = Instance.new("BoolValue", plr)
GB.Name = "GroupBonus"
GB.Value = false
local ID = Instance.new("BoolValue", plr)
ID.Name = "IsDueling"
ID.Value = true
local Skin = Instance.new("StringValue", plr)
Skin.Name = "CurrentSkin"
Skin.Value = "ClassicSword"
local MissingLink = Instance.new("StringValue", plr)
MissingLink.Name = "MissingLink"
MissingLink.Value = "false"
if plr:IsInGroup(2852908) then
if GB.Value == false then
plr:WaitForChild('leaderstats'):WaitForChild('Cash').Value = plr:WaitForChild('leaderstats'):WaitForChild('Cash').Value + 500
GB.Value = true
else
end
end
local GetSaved = DSService:GetAsync(uniquekey)
if GetSaved then
i.Value = GetSaved[1]
w.Value = GetSaved[2]
GB.Value = GetSaved[3]
Skin.Value = GetSaved[4]
MissingLink.Value = GetSaved[5]
else
local NumbersForSaving = {i.Value, w.Value, GB.Value, ID.Value, Skin.Value, MissingLink.Value}
DSService:SetAsync(uniquekey, NumbersForSaving)
end
end)
game.Players.PlayerRemoving:connect(function(plr)
local uniquekey = "id-"..plr.userId
local Savetable = {plr.leaderstats.Cash.Value, plr.leaderstats.Wins.Value, plr['GroupBonus'].Value, plr['IsDueling'].Value, plr['MissingLink'].Value, plr['CurrentSkin'].Value}
DSService:SetAsync(uniquekey, Savetable)
end)

2 comments
Ah okay that makes a lot more sense thank you!
Sweet I had to do a little bit more work here and there but I finally got it to where there's no errors thank you!