Hi, I need help with a datastore script that saves the cars you've bought. I've been trying and trying but I can't seem to figure it out. The way the car spawns is by a gui button. The car spawns fine and the buying event of the car works fine. I followed AlvinBloxs' video on how to make a car spawner gui: https://www.youtube.com/watch?v=zM6QhIn_JBY

In ReplicatedStorage there is a Remote Function named "CheckPrice" and Remote Event named "SpawnCar".

The cars are in ServerStorage in a folder named "Cars". In the folder are 2 cars, one car named "Car" and another car named "2008 Honda CR-V". In each car is a IntValue named "Price". Each IntValue has a value of 1000.

Also in StarterGui is a screen gui named "PurchaseGUI". In it is a frame named "Frame" and in it are 2 image labels which have the same name of the cars(So one image label named "Car" and another named "2008 Honda CR-V"). In each ImageLabel there is a Text Button named "BuyButton". In each buy button there is a BoolValue named "Purchased" and a LocalScript named "LocalScript". In the LocalScript it says:

script.Parent.MouseButton1Click:Connect(function()

    if script.Parent.Purchased.Value == true then
        game.ReplicatedStorage.SpawnCar:FireServer(script.Parent.Parent.Name)
    else
        local PriceOfItem = game.ReplicatedStorage:WaitForChild("CheckPrice"):InvokeServer(script.Parent.Parent.Name)

        if game.Players.LocalPlayer.leaderstats.Money.Value >= PriceOfItem and script.Parent.Purchased.Value == false then

            game.Players.LocalPlayer.leaderstats.Money.Value = game.Players.LocalPlayer.leaderstats.Money.Value - PriceOfItem
            print("Car was bought")
            script.Parent.Purchased.Value = true
        end
    end
end)

The leader stats and the spawn vehicle script are in the same script in ServerScriptService:

game.Players.PlayerAdded:Connect(function(plr)

    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = plr

    local money = Instance.new("IntValue")
    money.Name = "Money" -- The name that shows at the top change if you want
    money.Value = 10000 -- How much to start with
    money.Parent = leaderstats

end)


game.ReplicatedStorage:WaitForChild("CheckPrice").OnServerInvoke = function(player,NameOfCar)

    return game.ServerStorage.Cars:FindFirstChild(NameOfCar).Price.Value

end

game.ReplicatedStorage:WaitForChild("SpawnCar").OnServerEvent:Connect(function(player,NameOfCar)
    local car = game.ServerStorage.Cars:FindFirstChild(NameOfCar):Clone()
    car:SetPrimaryPartCFrame(player.Character.HumanoidRootPart.CFrame + Vector3.new(0,0,15))
    car.Parent = workspace
    car:MakeJoints()
    car.Name = player.Name.."'s "..NameOfCar
    if game.ServerStorage.Cars:FindFirstChild(NameOfCar):Clone()then
        game.ServerStorage.Cars.Car.Value = true
    end
end)

If you need more information please notify me.