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)

5 comments
It should work. Attempt turning on access to the api service.
In game settings.
We have the API service on already
people can see it, its the server. server can only have access to datastore. either you disable the leaderboard on a localscript
try not testing it in studio, try testing it in game btw