I am working on a custom leaderboard GUI and it is not working correctly for no apparent reasons to me
This is the script:
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
wait(2)
local frame = script.Parent.stock
local players = 0
local positiondifference = 20
for i,v in pairs(game.Players:GetChildren()) do
players = players+1
local e = frame:Clone()
e.Position = UDim2.new(0, 0, tonumber("0.0"..tostring(positiondifference*players)), 0)
-- I made sure this works by printing the number created by tonumber("0.0"..tostring(positiondifference*players)).
e.Text = v.Name
e.Name = v.Name
end
script.Parent.Parent.loading:Destroy()
print(players) -- check to see if there was a ghost error, which there was not
game.Players.PlayerAdded:connect(function(p)
players = players+1
local e = frame:Clone()
e.Position = UDim2.new(0, 0, 0, positiondifference*players)
e.Text = p.Name
e.Name = p.Name
end)
game.Players.PlayerRemoving:connect(function(p)
if script.Parent:FindFirstChild(p.Name) then
script.Parent[p.Name]:Remove()
end
end)
The part of the script that seems to not operate correctly is this part: local e = frame:Clone()
It just dose not even work despite the fact it’s written in RAW CODE without any error being thrown out or given to me.
This is the format of the UI:
Thank you.