Im trying to get the leaderstats of a player but my function doent work.
function GetStats()
for _,v in next,Players:GetChildren() do
for _,c in next,v:WaitForChild("leaderstats"):GetChildren() do
if c:IsA("NumberValue") then
for _,vx in pairs(c) do
print(vx.Value)
end
end
end
end
end
local players = game:GetService("Players")
local function getStats()
for _, player in ipairs(players:GetPlayers()) do
local leaderstats = player:FindFirstChild"leaderstats"
if leaderstats then
for _, stat in ipairs(leaderstats:GetChildren()) do
if stat:IsA"ValueBase" then
if stat:IsA"NumberValue" or stat:IsA"IntValue" then
--Do code.
end
end
end
end
end
end