Never mind i fixed it
local DataStoreService = game:GetService("DataStoreService") local DataStore = DataStoreService:GetDataStore("Money") game.Players.PlayerAdded:Connect(function(Player) local Leaderstats = Instance.new("Folder") Leaderstats.Name = "leaderstats" Leaderstats.Parent = Player local Currency = Instance.new("StringValue") Currency.Name = "Money" Currency.Value = DataStore:GetAsync(Player.UserId) or 0 Currency.Parent = Leaderstats end) game.Players.PlayerRemoving:Connect(function(Player) DataStore:SetAsync(Player.UserId, Player.leaderstats.Money.Value) end)
Here is the good script
local DataStoreService = game:GetService("DataStoreService") local DataStore = DataStoreService:GetDataStore("MoneyStats") -- Change this with a random name. game.Players.PlayerAdded:Connect(function(Player) local Leaderstats = Instance.new("Folder") Leaderstats.Name = "leaderstats" Leaderstats.Parent = Player local Currency = Instance.new("StringValue") Currency.Name = "Money" -- Change this with your currency name. Currency.Value = DataStore:GetAsync(Player.UserId) or "0" Currency.Parent = Leaderstats end) game.Players.PlayerRemoving:Connect(function(Player) DataStore:SetAsync(Player.UserId, Player.leaderstats.Money.Value) end)