How do I make it to where you click the player on player list and it removes them? from the game
local SizePer = 0.0275 --0.0475
local Players = game.Players
local List = script.Parent.PlayersComboBox.List
local OC = script.Parent.PlayersComboBox.OC
local Sign = script.Parent.PlayersComboBox.Sign
local BlankPlayer = script.Parent.Player
local BlankTable = {}
local BlankNumber = 0
function UpdateGui()
BlankTable = {}
BlankNumber = 0
for i, oldplayers in pairs(List:GetChildren()) do
oldplayers:Destroy()
end
List.Size = UDim2.new(1,0,SizePer,0)
local numPlayers = 0
local GetPlayers = game.Players:GetChildren()
for i, player in pairs(GetPlayers) do
if player.className == "Player" then
numPlayers = numPlayers + 1
local PlayerTag = BlankPlayer:clone()
PlayerTag.Name = player.Name
PlayerTag.Text = player.Name
PlayerTag.Size = UDim2.new(1,0,(1/numPlayers),0)
PlayerTag.Position = UDim2.new(0,0,PlayerTag.AbsoluteSize.Y,0)
PlayerTag.Visible = true
----------------------------------------------------------------------------------------
--function playerClicked()
-- print("PlayerClicked ran")
---- player.Name = Name33
-- print("Set Player.Name to Name33")
--
-- game.Players.Name33:Remove()
-- print("Attempting to remove selected player")
--end
--print("Ending function")
--script.Parent.PlayersComboBox.List.MouseButton1Down:connect(playerClicked)
--print("executing function")
---------------------------------------------------------------------------------------------
table.insert(BlankTable,PlayerTag)
end
end
List.Size = UDim2.new(1,0,SizePer * #BlankTable,0)
BlankNumber = 0
for i, newplayers in pairs(BlankTable) do
newplayers.Size = UDim2.new(1,0,(1/numPlayers),0)
newplayers.Position = UDim2.new(0,0,BlankNumber/numPlayers,0)
newplayers:clone().Parent = List
BlankNumber = BlankNumber + 1
end
end
game.Players.PlayerAdded:connect(function()
UpdateGui()
end)
game.Players.PlayerRemoving:connect(function()
UpdateGui()
end)
UpdateGui()
OC.MouseButton1Down:connect(function()
if List.Visible == false and Sign.Text == "+" then
List.Visible = true
Sign.Text = "-"
elseif List.Visible == true and Sign.Text == "-" then
List.Visible = false
Sign.Text = "+"
else
end
end)