Alright so i asked this question already about a month ago i did get an answer but it didnt seem to fix the problem so here it is. So basicly its a Datastore script thats meant to save the player`s cash and the vehicles that the player has purchased but it only saves the cash value but it dosent save the cars purchased, could someone help?
Script:
local DataStore = game:GetService("DataStoreService") local ds1 = DataStore:GetDataStore("im not showing this") local success, err = pcall(function() game.Players.PlayerAdded:connect(function(player) local leader = Instance.new("Folder", player) leader.Name = "leaderstats" local Cash = Instance.new("IntValue", leader) Cash.Name = "Cash" Cash.Value = ds1:GetAsync(player.UserId) or 0 ds1:SetAsync(player.UserId, Cash.Value) ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Zilko_Natalia.Purchased.Value, player.UserId.."Purchased_Zilko_Natalia") ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Voyage_D.Purchased.Value, player.UserId.."Purchased_Voyage_D") ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.DA_Ferra.Purchased.Value, player.UserId.."Purchased_DA_Ferra") ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.DA_Venerra.Purchased.Value, player.UserId.."Purchased_DA_Venerra") ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Hektor_Mediona.Purchased.Value, player.UserId.."Purchased_Hektor_Mediona") ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Mounts_Rake.Purchased.Value, player.UserId.."Purchased_Mounts_Rake") ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Novena_Acesera.Purchased.Value, player.UserId.."Purchased_Novena_Acesera") ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Roland_Motors_GTR.Purchased.Value, player.UserId.."Purchased_Roland_Motors_GTR") ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Surge_Maple_R.Purchased.Value, player.UserId.."Purchased_Surge_Maple_R") ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Voyage_Jalanster_Betamobili.Purchased.Value, player.UserId.."Purchased_Voyage_Jalanster_Betamobili") ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Voyage_Pengangkuter_30_CWT.Purchased.Value, player.UserId.."Purchased_Voyage_Pengangkuter_30_CWT") ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.DA_Ferra_F8_RT_Edition.Purchased.Value, player.UserId.."Purchased_DA_Ferra_F8_RT_Edition") wait(5) --Cash.Changed:connect(function() print("SavingData") ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Zilko_Natalia.Purchased.Value) ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Voyage_D.Purchased.Value) ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.DA_Ferra.Purchased.Value) ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.DA_Venerra.Purchased.Value) ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Hektor_Mediona.Purchased.Value) ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Mounts_Rake.Purchased.Value) ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Novena_Acesera.Purchased.Value) ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Roland_Motors_GTR.Purchased.Value) ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Surge_Maple_R.Purchased.Value) ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Voyage_Jalanster_Betamobili.Purchased.Value) ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Voyage_Pengangkuter_30_CWT.Purchased.Value) ds1:SetAsync(player.UserId, Cash.Value) end) --end) game.Players.PlayerRemoving:connect(function(player) local SavedData = Instance.new("BindableEvent") ds1:setAsync(player.UserId, player.leaderstats.Cash.Value) ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Zilko_Natalia.Purchased.Value) ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Voyage_D.Purchased.Value) ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.DA_Ferra.Purchased.Value) ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.DA_Venerra.Purchased.Value) ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Hektor_Mediona.Purchased.Value) ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Mounts_Rake.Purchased.Value) ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Novena_Acesera.Purchased.Value) ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Roland_Motors_GTR.Purchased.Value) ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Surge_Maple_R.Purchased.Value) ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Voyage_Jalanster_Betamobili.Purchased.Value) ds1:SetAsync(game.StarterGui.PurchaseGUI.Frame.Voyage_Pengangkuter_30_CWT.Purchased.Value) SavedData:Fire() game:BindToClose(function() SavedData.Event:Wait() end) end) end)
So You cannot save a model or type of physical thing as a value. Theoretically, you could but that would be a lot of unnecessary scripting. To-Do what you are asking you might want to put the Cars/Something you are saving Into the ServerStorage Service. Therefore you can start the process.
You Should clone the cars in ServerStorage, for example:
game.ServerStorage.Car1:Clone().Parent = player -- Put the player name or how parameter
This would work, but its best to keep it organized so doing this would be better
game.ServerStorage.CarFolder.Car1:Clone().Parent = player
There we go inside the folder to grab the car. This will make using Datastores a lot easier when you start to insert them into the DataStoreServiceFolder.
After you need to Clone the cars into the folder that is in leader stats and the player. Note You do not need to get rid of the Cash value in the leaderstats
You need to save the folder that is in the player to a Datastore so you can receive it later on the line. Next, you need to put the folder in the player like you would a cash datastore.
You would run an if statement on your game to check and see when a player wants to spawn a car. If they have the car in their folder then your car spawner will do its job
If this helped explain this please accept it as an answer