I have a problem with this datastore it takes the same thing every time say it’s a BoolValue and when I leave it stores them both as true…
local m = require(script.Parent.Instellingen)
local DSS = game:GetService("DataStoreService"):GetDataStore("CarDealerSpijkenisse")
game.Players.PlayerAdded:Connect(function(plr)
if DSS:GetAsync(plr.UserId.."-AUTODATA") ~= nil then
local F = Instance.new("Folder", plr)
F.Name = "AutoStats"
for i, v in pairs(m.Autos) do
local C = script.Parent.Example:Clone()
C.Parent = F
C.Name = v.Naam
C.Value = DSS:GetAsync(plr.UserId.."-AUTODATA")
end
else
local F = Instance.new("Folder", plr)
F.Name = "AutoStats"
for i, v in pairs(m.Autos) do
local C = script.Parent.Example:Clone()
C.Parent = F
C.Name = v.Naam
C.Value = false
end
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
local Save = {}
for i, v in pairs(plr.AutoStats:GetChildren()) do
Save[v] = v.Value
DSS:SetAsync(plr.UserId.."-AUTODATA", Save)
end
end)