Hello,
I am trying to create a custom leaderboard but the textlabel is not visilbe (I print and it told me it’s visible but on my screen it’s not created (on client side)).
local Teams = game:GetService("Teams"):GetTeams()
local rs = game:GetService("ReplicatedStorage")
local plrs = game:GetService("Players")
local function existInArray(array, value)
for i,v in pairs(array) do -- v est les textLabel
for i = 1, 30, 1 do
local labelName = string.sub( -- Permet de reconstituer le nom du joueur qui est dans le textlabel
"1."..tostring(i).." "..v.Name, -- Prend le nom du textlabel
string.find("1."..tostring(i).." "..v.Name, v.Name) -- Prend les index du nom du textlabel
)
if labelName == value then
return true
end
end
end
return false
end
local i_police = 0
while wait(1) do
for _, team in pairs(Teams) do
if team.Name ~= "Citizen" then
local players = team:GetPlayers()
if #players > 0 then
if not script.Parent:FindFirstChild(team.Name) then
local title = script.Parent.FORMATTitle:Clone()
title.Name = team.Name
title.Text = team.Name
title.Visible = true
title.Parent = script.Parent
end
for i,v in pairs(players) do
if plrs:GetPlayerByUserId(plrs:GetUserIdFromNameAsync(v.Name)) then
local playerName = v.Name
local userID = plrs:GetUserIdFromNameAsync(playerName)
local APs = rs.Events.Modules.GetAPsUserID:InvokeServer(userID)
local Rank = rs.Events.Modules.GetRankUserID:InvokeServer(userID)
if team.Name == "Police" then
local playerNameInTextLabel = string.sub( -- Permet de reconstituer le nom du joueur
"1."..tostring(i_police).." "..playerName, -- Nom du label
string.find("1."..tostring(i_police).." "..playerName, playerName) -- Prend les index du nom du joueur
)
if not existInArray(script.Parent:GetChildren(), playerNameInTextLabel) then
local p = script.Parent.FORMATPlayer:Clone()
p.Name = "1."..tostring(i_police).." "..playerName
p.Text = playerName.." | "..tostring(APs).." AP | "..tostring(Rank)
p.Visible = true
p.Parent = script.Parent
i_police += 1
end
end
end
end
end
end
end
for i,v in ipairs(script.Parent:GetChildren()) do
if v:IsA("TextLabel") then
if v.Name ~= "FORMATPlayer" and v.Name ~= "FORMATTitle" then
if v.Name ~= "Police" and v.Name ~= "Redacted" and v.Name ~= "Citizen" then
if not plrs:FindFirstChild(v.Name) then
v:Destroy()
end
end
end
end
end
end