I don't know what I am doing wrong but in the output it says "value is not a valid member of BoolValue" in red. The problem is somewhere in here but I can't figure it out.
local serverStorage = game:GetService("ServerStorage") game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player local strength = Instance.new("NumberValue") strength.Name = "Strength" strength.Parent = leaderstats local rebirths = Instance.new("IntValue") rebirths.Name = "Rebirths" rebirths.Parent = leaderstats local dataFolder = Instance.new("Folder") dataFolder.Name = player.Name dataFolder.Parent = serverStorage.RemoteData local debounce = Instance.new("BoolValue") debounce.Name = "Debounce" debounce.Parent = dataFolder end)
Are you trying to make a leaderstat that saves if so then use this `local DSService2 = game:GetService('DataStoreService'):GetDataStore('StrengthSaveSystem')
local DSService1 = game:GetService('DataStoreService'):GetDataStore('RebirthSaveSystem')
game.Players.PlayerAdded:Connect(function(plr)
-- Define variables
local uniquekey = 'id-'..plr.userId
local leaderstats = Instance.new('IntValue', plr)
leaderstats.Name = 'leaderstats'
local fakestats = Instance.new('Folder', plr)
fakestats.Name = 'fakestats'
local savevalue2 = Instance.new('IntValue')
savevalue2.Parent = leaderstats
savevalue2.Name = "Strength"
local savevalue3 = Instance.new('IntValue')
savevalue3.Parent = leaderstats
savevalue3.Name = "Rebirths"
-- GetAsync
local GetSaved = DSService1:GetAsync(uniquekey)
if GetSaved then
savevalue2.Value = GetSaved[1]
savevalue3.Value = GetSaved[2]
else
local NumbersForSaving = {savevalue2.Value, savevalue3.Value}
DSService1:SetAsync(uniquekey, NumbersForSaving)
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
local uniquekey = 'id-'..plr.userId
local Savetable1 = {plr.leaderstats["Strength"].Value, plr.leaderstats["Rebirths"].Value}
DSService1:SetAsync(uniquekey, Savetable1)
end)`