Hello everyone this code i am using is open-sourced but what does this mean because my games car buying is not working and output shows this
maybe try showing your script and the explorer
“attempt to index nil with ‘Value’” means that whatever you tried to get the property/child from that is named “Value” is nil
like:
This example shows something that has a .Value property that can be printed
local number = Instance.new("NumberValue")
number.Value = 3
number.Parent = workspace
print(number.Value) -- 3
While this is something that can also error the same thing from your photo
local number
print(number.Value) -- number being nil
Send me what the variable Cash is and Cost
Wallet is the name for cash want pic of leaderstats
Sure, send me the whole script.
Is Cash a value? The code is saying it can’t find the value of Cash.Value
local DSS = game:GetService(“DataStoreService”)
local statsDS = DSS:GetDataStore(“statsDS”)
game.Players.PlayerAdded:Connect(function(plr)
local lead = Instance.new(“Folder”)
lead.Name = “leaderstats”
lead.Parent = plr
local Wallet = Instance.new("IntValue")
Wallet.Name = "Wallet"
Wallet.Parent = lead
Wallet.Value = 100000
local diam = Instance.new("IntValue")
diam.Name = "Bank"
diam.Parent = lead
Wallet.Value = 0
--local Reb = Instance.new("IntValue")--
--Reb.Name = "Miles"--
– Reb.Parent = lead–
–Wallet.Value = 0–
local data
local succ, err = pcall(function()
data = statsDS:GetAsync(plr.UserId.."-stats")
end)
if succ then
print("success")
if data then --if there was some data then
print("Got the data from the player datastore")
Wallet.Value = data[1]
diam.Value = data[2]
--Reb.Value = data[3] --
end
else
print("There was an error while checking: "..plr.Name)
warn(err)
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
print(“Player is leaving the game!”)
local Wallet = plr.leaderstats.Wallet.Value
local diam = plr.leaderstats.Bank.Value
–local reb = plr.leaderstats.Miles.Value–
print(“Got all the values”)
local data = {Wallet, diam,}
local succ, err = pcall(function()
statsDS:SetAsync(plr.UserId.."-stats", data)
end)
if succ then
print("Succesfully saved the data!")
else
print("There was an error while saving player leaderstats!")
warn(err)
end
end)
Can we see the entire script for the one returning the errors?
wait i will show after i test something
so i got the buying working now the selling wont work lol
does the $ mean the value of data like money etc
Is it displaying more errors or no errors?

