So I'm attempting to make an Admin Panel but I ran into a problem. I use Instance.new() to create a new TextButton when a player is added into the game. How would I use MouseButton1Click for each instance to click the new text button that was created?
This is my update function to add the text buttons into the panel.
function update()
for i,v in pairs(game.Players:GetChildren())do
if playerList:FindFirstChild(v.Name) then playerList[v.Name]:Destroy() else
local newPlayer = Instance.new("TextButton")
newPlayer.Name = v.Name
newPlayer.Text = v.Name
newPlayer.TextScaled = true
newPlayer.Parent = playerList
end
end
end
When a player is added into the game it adds the text button like this. Here!
Simpled down: Use MouseButton1Click on a new Text Button that was created using Instance.new()

1 comment
Oh thanks! I didn't think about that.