when i have this script in ServerScriptService it only adds "Total"
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 Toal = Instance.new("IntValue",leader) Toal.Name = "Total" Toal.Value = ds:GetAsync(player.UserId) or 0 ds:SetAsync(player.UserId, Toal.Value) Toal.Changed:connect(function() ds:SetAsync(player.UserId, Toal.Value) local Money = Instance.new("IntValue",leader) Money.Name = "Money" Money.Value = ds:GetAsync(player.UserId) or 0 ds:SetAsync(player.UserId, Money.Value) Money.Changed:connect(function() ds:SetAsync(player.UserId, Money.Value) end) end) end) game.Players.PlayerRemoving:connect(function(player) ds:SetAsync(player.UserId, player.leaderstats.Total.Value) ds:SetAsync(player.UserId, player.leaderstats.Money.Value) end)
Your issue is being caused because of the Second Argument of `Instance.new() being deprecated; no longer supported. This can be fixed easily by writing this instead
game.Players.PlayerAdded:Connect(function(player) local leader = Instance.new("Folder"); leader.Parent = player leader.Name = "leaderstats" local Toal = Instance.new("IntValue"); Total.Parent = leader Toal.Name = "Total" local Money = Instance.new("IntValue"); Money.Parent = leader Money.Name = "Money" end)