local DataStoreService = game:GetService("DataStoreService") local leaderstats = DataStoreService:GetDataStore("TEST") local settings={ groupid = 0 } game.Players.PlayerAdded:connect(function(player) local key = "user_"..player.userId game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("IntValue",player) leaderstats.Name = "leaderstats" local rank = Instance.new("StringValue", leaderstats) rank.Name = "Rank" rank.Value = player:GetRoleInGroup(settings["groupid"]) local points = Instance.new("IntValue", leaderstats) points.Name = "TEST" points.Value = points:GetAsync(key) points.Changed:connect(function() points:SetAsync(key, points.Value) end) end)
Try using this script (Yes I did make it myself.):
local data = game:GetService("DataStoreService"):GetDataStore("TEST") local settings={ groupid = 0 } game:GetService("Players").PlayerAdded:connect(function(player) local key = "user_"..player.UserId local leaderstats = Instance.new("Folder", player) leaderstats.Name = "leaderstats" local rank = Instance.new("StringValue", leaderstats) rank.Name = "Rank" rank.Value = player:GetRoleInGroup(settings["groupid"]) local GetPlayerSave = data:GetAsync("user"..player.UserId) local points = Instance.new("NumberValue", leaderstats) points.Value = 0 points.Name = "TEST" if GetPlayerSave then points.Value = GetPlayerSave[1] or 0 end end) game:GetService("Players").PlayerRemoving:connect(function(player) local leaderstats = player:WaitForChild("leaderstats") local ToSave = {leaderstats.TEST.Value} data:SetAsync("user_"..player.userId, ToSave) end)