I'm trying to save the points and points per second for my player point clicker game but it isn't working and I have no idea why. Can someone please help?
local pointStore = game:GetService("DataStoreService"):GetDataStore("playurData") local playurData = {} function ledurburd(playur) local ledurstatts = Instance.new("Model", playur) ledurstatts.Name = "leaderstats" local yourData = pointStore:GetAsync(playur.userId) or {} yourData.pp = yourData.Points or 0 yourData.ppPerSec = yourData.ppPerSec or 0 playurData[playur.userId] = yourData local pp = Instance.new("IntValue", ledurstatts) pp.Name = "Points" pp.Value = yourData.pp local ppPerSec = Instance.new("IntValue", playur) ppPerSec.Name = "PointsPerSecond" ppPerSec.Value = yourData.ppPerSec end game.Players.PlayerAdded:connect(ledurburd) function permaSave(playur) if playur then local yourData = playurData[playur.userId] if yourData then pointStore:SetAsync(playur.userId, yourData) end end end game.Players.PlayerRemoving:connect(function(playur) if playur then permaSave(playur) playurData[playur.userId] = nil end end) game.OnClose = function() for i,v in pairs(playurData) do pointStore:SetAsync(i, v) end end