Ad
Log in to vote
0

does anyone know how to change it so it saves everything in game.Players.LocalPlayer.Character?

Asked by
ojinga -14
3 years ago

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 = "Cash" 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)

1
No since we do not know what "everything" is? User#5423 -10 — 3y

Answer this question