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)

3 comments

0

Use a code block

0

Try getting rid of the saving line just before the changed event. I can see this saving their points as zero before the value is updated. Also, make sure you use a code block when you post your scripts. That makes it more easy for us to read.

0

What is code block?