Hierarchy: https://gyazo.com/057a1667edd9835e820b4fb50d147790
So, there's the player, and there's a bunch of BoolValues for the type of cars the player owns. On default, I set one to true which is a beginner car, it's always true, but when I try to save the other ones; they seem not to save or work. The Money and JailTime Values do save because they're IntValues, but the BoolValues don't. Do BoolValues save through DataSaves?
Data Script:
game.Players.PlayerAdded:Connect(function(plr)
local stats = Instance.new("IntValue")
stats.Name = "BackendData"
stats.Parent = plr
local cash = Instance.new("IntValue")
cash.Name = "Money"
cash.Parent = stats
cash.Value = 75000
local jail = Instance.new("IntValue")
jail.Name = "Jail Time"
jail.Parent = stats
for _,car in pairs(game:GetService("Lighting"):WaitForChild("Cars",5):GetChildren()) do
local b = Instance.new("BoolValue")
b.Parent = stats
b.Name = car.Name
end
wait(2.5)
if plr:WaitForChild("BackendData",5):WaitForChild("2009 Chevrolet Cobalt SS",5) then
local defaultCar = plr:WaitForChild("BackendData",5):WaitForChild("2009 Chevrolet Cobalt SS",5)
defaultCar.Value = true
end
end)
DataSave Script:
local AUTO_SAVE = true
local TIME_BETWEEN_SAVES = 60
local PRINT_OUTPUT = true
local SAFE_SAVE = true
local players = game:GetService("Players")
local dataStoreService = game:GetService("DataStoreService")
local leaderboardData = dataStoreService:GetDataStore("I8SB90AnsjGJAK?FA*Ms")
local function Print(message)
if PRINT_OUTPUT then print(message) end
end
local function SaveData(player)
wait(2.5)
if player.userId < 0 then return end
player:WaitForChild("BackendData")
wait()
local BackendData = {}
for i, stat in pairs(player.BackendData:GetChildren()) do
table.insert(BackendData, {stat.Name, stat.Value})
end
leaderboardData:SetAsync(player.userId, BackendData)
Print("Saved "..player.Name.."'s data")
end
local function LoadData(player)
if player.userId < 0 then return end
player:WaitForChild("BackendData")
wait()
local leaderboardStats = leaderboardData:GetAsync(player.userId)
for i, stat in pairs(leaderboardStats) do
local currentStat = player.BackendData:FindFirstChild(stat[1])
if not currentStat then return end
currentStat.Value = stat[2]
end
Print("Loaded "..player.Name.."'s data")
end
players.PlayerAdded:connect(LoadData)
players.PlayerRemoving:connect(SaveData)
if SAFE_SAVE then
game.OnClose = function()
for i, player in pairs(players:GetChildren()) do
SaveData(player)
end
wait(1)
end
end
while AUTO_SAVE do
wait(TIME_BETWEEN_SAVES)
for i, player in pairs(players:GetChildren()) do
SaveData(player)
end
end
Both of these scripts are in ServerScriptService, API Enabled, and HTTP Requests Enabled. Any help?

2 comments
I don't know if its possible to save bool values, and while it very well may be, you could just create a new value in the players stats folder when they leave the game. If the bool value was true then you could set the value to 1, otherwise set it to 0. This would also mean that when they join back that you would have to redefine the bool value though.
Yeah, I could do that. I'm pretty sure you used to be able to save BoolValues, I'm not sure anymore. In the player spawn list I could just check if the Value is 1 (true) or 0 (false) and then get the car. I'll do that if I can't find anything else on saving BoolValues. Thanks for your help.