These are the script that I have input for my point datastore system, It's like it does not work it only work once but then like when you rejoined the game like 3 times it does not save anymore. Please help.
This is the script.
local DataStore = game:GetService("DataStoreService") local ds = DataStore:GetDataStore("PointsSaveSystem")
game.Players.PlayerAdded:connect(function(player) local leader = Instance.new("Folder",player) leader.Name = "leaderstats" local Points = Instance.new("IntValue",leader) Points.Name = "Points" Points.Value = ds:GetAsync(player.UserId) or 0 ds:SetAsync(player.UserId, Points.Value) Points.Changed:connect(function() ds:SetAsync(player.UserId, Points.Value) end) end)
game.Players.PlayerRemoving:connect(function(player) ds:SetAsync(player.UserId, player.leaderstats.Points.Value) end)