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
:O THIS LOOKS LIKE A JOB FOR... MESSORADMIN!!\ cricket chirps\ stfu cricket.
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()