Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make modular Scrolling Frame?

Asked by 4 years ago

I have a problem with a scrolling frame which is showing a list of all players. When they are 3 or fewer players everything looks good (Example with 3 people) but the problem shows when there are 4 or more players (Example). As you see the space between the players is big and it only shows 2 of them, not all.

The code of local script that shows the list:

function RegisterPlayers()
local Y = 0.42
local Ynew = 0.42
local Primal = script.Parent.Back
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size420x420
local place = 0
        local Playerlist = game.ReplicatedStorage.GetPlayers:InvokeServer()
        print(#Playerlist)
        for i = 1,#Playerlist do
            local player = Playerlist[i]
            if player.name ~= game.Players.LocalPlayer.Name then
                local Av = game.Players:GetUserThumbnailAsync(player.UserId, thumbType, thumbSize)
                local Clone = Primal:Clone()
                Clone.Parent = script.Parent
                Clone.Name = player.Name
                Clone.Image.Image = Av
                Clone.Visible = true
                Clone.PName.Text = tostring(Clone.Name)
                Clone.Position = UDim2.new(0.1,0,Ynew,0)
                Ynew = Ynew + Y 
                place = place + 1
                if place >= 3 then
                    script.Parent.CanvasSize = script.Parent.CanvasSize + UDim2.new(0,0,1.83,0)
                end
            end
        end
    end

RegisterPlayers()
script.Disabled = true

Answer this question