Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My Cash saving script ist working. Console just says "Cash isnt a valid member of folder"?

Asked by 4 years ago

I wanted to make a Cash saving script. It says Cash is not a valid member of folder. (Note: Im not that good in englisch, so please dont use super complicated words, thanks)

local DataStore = game:GetService("DataStoreService")
local ds = DataStore:GetDataStore("CashSaveSystem")

game.Players.PlayerAdded:connect(function(player)
    local leader = Instance.new("Folder",player)
    leader.Name = "leaderstats"
    local Cash = Instance.new("IntValue",leader)
    Cash.Name = "Coins"
    Cash.Value = ds:GetAsync(player.UserId) or 0
    ds:SetAsync(player.UserId, Cash.Value)
    Cash.Changed:connect(function()
        ds:SetAsync(player.UserId, Cash.Value)
    end)
end)


game.Players.PlayerRemoving:connect(function(player)
    ds:SetAsync(player.UserId, player.leaderstats.Cash.Value)
end)
0
You name the IntValue "Coins" (line 8) and you try to find the IntValue name "Cash" (line 18). Block_manvn 395 — 4y
0
Yeah, either change line 8 to name it "Cash", or change line 18 to be Coins.Value zandefear4 90 — 4y
0
It just isnt working. I changed 8 to Cash.Name="Cash" and it shows no error, but it isnt saving anything TheHardKnockLite -5 — 4y

Answer this question