This is my code:
local DataStoreService = game:GetService("DataStoreService")
local PointsStore = DataStoreService:GetDataStore("BBSystems", "PointsValueHolder")
game.Players.PlayerAdded:Connect(function(Player)
local Key = "uid_" .. Player.UserId
local leaderstats = Instance.new("Folder")
local Points = Instance.new("NumberValue")
local Rank = Instance.new("StringValue")
leaderstats.Parent = Player
leaderstats.Name = "leaderstats"
Points.Parent = leaderstats
Points.Name = "Points"
Points.Value = PointsStore:GetAsync(Key)
Rank.Parent = leaderstats
Rank.Name = "Rank"
Rank.Value = Player:GetRoleInGroup(4494167)
end)
game.Players.PlayerRemoving:Connect(function(Player)
local Key = "uid_" .. Player.UserId
PointsStore:SetAsync(Key, Player.leaderstats.Points.Value)
end)
and for some reason It will not load the data up when the play joins (Im not sure if it saves it either)
If you could help, that would be much appreciated!

8 comments
Doesn't work..
It works for me. here, I'll edit it to show the final code. you need to join an actual game by the way- data won't save in studio. I actually did change a few things but it works- saves points and gets the players current group rank. accept my answer if everything works :)
Doesn't work.. Where is your script placed?
a server script under ServerScriptStorage
Nothing
I edited my answer, are you sure your doing everything? I have this very script under serverscriptstorage and it works. you must be doing something wrong.
I imputed the code into a script, put that script in serverscriptstorage but nothing
do you have discord? ill help koala#6590 i dont know why its not working for you. it works for me and it only saves IN GAME not in STUDIO