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

Player list only showing first person?

Asked by 9 years ago

I am making a player list, and making it to pick someone as a suspect for something, but it's only working for the first person in the game, what did I do wrong?

Send.People:ClearAllChildren()
            local Spot = 0
            for _,v in pairs(game.Players:GetPlayers()) do
                local NT = PTab:Clone()
                NT.Parent = Send.People
                NT.Position = UDim2.new(0, 0, Spot, 0)
                NT.Name = v.Name
                NT.Text = v.Name
                Spot = Spot + 20
            end
            local Tabs = Send.People:GetChildren()
            for i = 1, #Tabs do
                Tabs[i].MouseButton1Down:connect(function()
                    Send.Suspect.Value = Tabs[i].Name
                    Send.SuspectLabel.Text = 'Selected Suspect: '..Tabs[i].Name
                end)
            end
0
We might need a bit more than this...any errors? dyler3 1510 — 9y
0
No errors. And this is the entire part of it, the rest is just the button click. TypicalModerator 110 — 9y

1 answer

Log in to vote
1
Answered by 9 years ago

Please provide code with your answers. Simply posting an explanation does not help someone new to programming understand how to implement a concept programatically.

:O THIS LOOKS LIKE A JOB FOR... MESSORADMIN!!\ cricket chirps\ stfu cricket.

Lol

function Update()
    Send.People:ClearAllChildren() -- Clear the gui
    local NewIndexTable = {}
    for i,v in next,game:GetService("Players"):GetPlayers() do
        local NewGui = PTab:Clone()
        NewGui.Parent = Send.People
        NewGui:TweenPosition(UDim2.new(0,0,(NewGui.Size.Y*#NewIndexTable),0), "In", "Quad",  1)
        NewGui.Name = v.Name -- Play around with the UDim2.. make it look good.. C:
        NewGui.Text = v.Name
        table.insert(NewIndexTable, NewGui)
        NewGui.MouseButton1Down:connect(function()
            Send.Suspect.Value = v.Name
            Send.SuspectLabel.Text = "Selected Suspect: "..v.Name
        end) -- Better then your for i loop c:
    end
end

Update()
Ad

Answer this question