I am trying to make it so data saves and other people can see it the leaderboard stats of other players.
ClickData = game:GetService("DataStoreService"):GetDataStore("ClickData3825") -- You can put anything here RebirthData = game:GetService("DataStoreService"):GetDataStore("RebirthData5936") -- and here game.Players.PlayerAdded:Connect(function(plr) local LB = Instance.new("IntValue", plr) LB.Name = "leaderstats" local p = Instance.new("IntValue", LB) p.Name = "Clicks" p.Value = ClickData:GetAsync(plr.userId) or 0 local r = Instance.new("IntValue", LB) 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) ClickData:SetAsync(plr.userId, plr.leaderstats.Clicks.Value) RebirthData:SetAsync(plr.userId, plr.leaderstats.Rebirths.Value) end)
Replace every 'userId' to 'UserId'
In line 13
p.Value = ClickData:GetAsync(plr.UserId) or 0
In line 17
r.Value = RebirthData:GetAsync(plr.UserId) or 0
In line 25
ClickData:SetAsync(plr.UserId, plr.leaderstats.Clicks.Value)
In line 26
RebirthData:SetAsync(plr.UserId, plr.leaderstats.Rebirths.Value)
I'm sure userId doesn't exist but UserId does