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

Cash is not a valid member of folder how to fix??

Asked by 5 years ago
Edited 5 years ago
local DataStore = game:GetService("DataStoreService")
local ds = DataStore:GetDataStore ("CashSaveSystem")

game.Players.PlayerAdded:connect(function(player)
    local leader = Instance.new("Folder")
    leader.Name = "leaderstats"
    local Cash = Instance.new("IntValue", leader)
    Cash.Name = "Cash"
    Cash.Value = ds:GetAsync(player.UserId) or 0
    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
The parent argument of Instance.new is deprecated. Don't use it GamingOverlord756 48 — 5y

Answer this question