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

Why does my entire player list disappear?

Asked by 6 years ago

I have a player list that's supposed to look like the 2008 player list and whenever I add stats it just all disappears?

It's in a Local Script if that's any help

    local lslabels = {} --Player Scores
    for i=1,#players do
        if players[i]:FindFirstChild("leaderstats") then
            local get = players[i].leaderstats:GetChildren()
            for i2=1,#get do
                if get[i2].ClassName == "IntValue" or get[i2].ClassName == "NumberValue" then
                    local ret = false
                    for i3=1,#lslabels do
                        if lslabels[i3].Name == get[i2].Name then
                            ret = true
                        end
                    end
                    if ret == false then
                        table.insert(lslabels,#lslabels+1,get[i2])
                    end
                    for i3=1,#lslabels do
                        if lslabels[i3].Name == get[i2].Name then
                            local nslabel = script:WaitForChild("ScoreLabel"):Clone()
                            nslabel.Text = tostring(get[i2].Value)
                            if i3 == 1 then
                                nslabel.Position = UDim2.new(0,155,0,0)
                            else
                                nslabel.Position = UDim2.new(0,155+(80/(i3-1)),0,0)
                            end
                            local get2 = playerlist:GetChildren()
                            for i4=1,#get2 do
                                if get2[i4].Name == "Team" then
                                    local get3 = get2[i4]:GetChildren()
                                    for i5=1,#get3 do
                                        if get3[i5].Name == "Player" and get3[i5].Text == players[i].Name then
                                            nslabel.TextColor3 = get3[i5].TextColor3
                                            nslabel.Parent = get3[i5]
                                        end
                                    end
                                elseif get2[i4].Name == "Player" and get2[i4].Text == players[i].Name then
                                    nslabel.Parent = get2[i4]
                                end
                            end
                        end
                    end
                end
            end
        end
    end
    local get = playerlist:GetChildren() --Team Scores
    if #teams > 0 then
        for i=1,#get do
            if get[i].Name == "Team" then
                local valtable = {}
                local get2 = get[i]:GetChildren()
                for i2=1,#get2 do
                    if get2[i2].Name == "Player" then
                        local get3 = get2[i2]:GetChildren()
                        for i3=1,#get3 do
                            if valtable[i3] then
                                valtable[i3] = valtable[i3] + tonumber(get3[i3].Text)
                            else
                                valtable[i3] = tonumber(get3[i3].Text)
                            end
                        end
                    end
                end
                for i2=1,#valtable do
                    local nslabel = script:WaitForChild("ScoreLabel"):Clone()
                    nslabel.Text = tostring(valtable[i2])
                    if i2 == 1 then
                        nslabel.Position = UDim2.new(0,155,0,0)
                    else
                        nslabel.Position = UDim2.new(0,155+(80/(i2-1)),0,0)
                    end
                    nslabel.TextColor3 = get[i]:FindFirstChild("_Label2").TextColor3
                    nslabel.TextStrokeTransparency = 0.5
                    nslabel.Parent = get[i]
                end
            end
        end
    end

That's the chunk where leaderstats and team stats are labeled I couldn't paste the entire script because of the 10k limit...

0
This looks overcomplicated... TheeDeathCaster 2368 — 6y

Answer this question