-
What do you want to achieve? Keep it simple and clear!
I want to display the top 25 players with the highest level in the scrolling frame -
What is the issue? Include screenshots / videos if possible!
The issue is that only the top 6.5 players are shown.
As you can see below the last player in the scrolling frame is Player19zzz but I have a warn that prints every player name possible.
I don’t have any experience with scrolling frames so I am not sure how to fix this issue, any help would be great!
local event = game:GetService("ReplicatedStorage"):WaitForChild("Leaderboard")
local sample = script:WaitForChild("Sample") --frame that gets put into scrollingframe
local frame = script.Parent
local ui = frame:WaitForChild("UI")
local function createFrame(number,name,image,val) --parent the frame to scrollingframe
local color = Color3.new(1,1,1)
if number == 1 then
color = Color3.new(1,1,0)
elseif number == 2 then
color = Color3.new(0.9,0.9,0.9)
elseif number == 3 then
color = Color3.fromRGB(166,112,0)
end
local new = sample:Clone()
new.Image.Image = image
new.Image.Num.Text = number
new.Nam.Text = name
new.Wins.Text = val
new.LayoutOrder = number
new.Image.Num.TextColor3 = color
new.Wins.TextColor3 = color
new.Nam.TextColor3 = color
new.Parent = frame
end
event.OnClientEvent:Connect(function(data)
for i,v in pairs(frame:GetChildren()) do
if v.Name == "Sample" then
v:Destroy()
end
end
for i, v in pairs(data)do
local name = data[i]["Name"]
local image = data[i]["Image"]
local val = data[i]["Wins"]
createFrame(i,name,image,val)
warn(name)
end
wait(0.1)
frame.CanvasSize = UDim2.new(0,0,1,0)
end)