PointData = game:GetService("DataStoreService"):GetDataStore("PointData")
RebirthData = game:GetService("DataStoreService"):GetDataStore("RebirthData")
game.Players.PlayerAdded:Connect(function(plr)
local LB = Instance.new("IntValue")
LB.Name = "leaderstats"
local p = Instance.new("IntValue")
p.Name = "Points"
p.Value = PointData:GetAsync(plr.userId) or 0
local r = Instance.new("IntValue")
r.Name = "Rebirths"
r.Value = RebirthData:GetAsync(plr.userId) or 0
LB.Parent = plr
p.Parent = LB
r.Parent = LB
end)
game.Players.PlayerRemoving:Connect(function(plr)
PointData:SetAsync(plr.userId, plr.leaderstats.Points.Value)
RebirthData:SetAsync(plr.userId, plr.leaderstats.Rebirths.Value)
end)
COMMUNITY QUESTION
MY DATASTORE SCRIPT ISNT WORKING WELL?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
ok why make the title all caps stop screaming at me plz
userid should be spelled like "UserId" and you should use the pcall function when calling datastores https://developer.roblox.com/en-us/api-reference/lua-docs/Lua-Globals
Marked as non-descriptive as the OP doesn't specify what part doesn't work.
I think that giving it medicine will make it work well.