but when i test it doesnt do it for me in game but in Studio its creating the TextButtons
local Players = game.Players
local Tags = require(game.ReplicatedStorage.Tags)
function newPlayerAdded( frame)
for i,v in pairs(Players:GetPlayers()) do
local TextLabel = Instance.new('TextButton', frame)
TextLabel.Name = v.Name
TextLabel.Size = UDim2.new(1,0, 0, 50)
TextLabel.BackgroundColor = BrickColor.new(0, 170, 127)
TextLabel.BackgroundTransparency = 0.5
TextLabel.TextScaled = true
TextLabel.Font = Enum.Font.FredokaOne
local newTags = Tags.new(v)
TextLabel.Text = newTags:CreateTag()
local uiCorner = Instance.new('UICorner', TextLabel)
uiCorner.CornerRadius = UDim.new(0, 12)
end
end
function playerLeft(player, Frame)
local textLabel = Frame:FindFirstChild(player.Name)
if Frame.Visible and textLabel then
if textLabel then
textLabel:Destroy()
end
elseif not Frame.Visible then
textLabel:Destroy()
end
end
Players.PlayerAdded:Connect(function(plr)
local playerGui = plr:WaitForChild('PlayerGui')
local playerLeft = playerGui:WaitForChild('PlayerList')
local frame = playerLeft:WaitForChild('playerlist')
local Stat = playerLeft:FindFirstChild('Stats'):FindFirstChild('PlayerStats')
newPlayerAdded(frame)
end)
Players.PlayerRemoving:Connect(function(plr)
local frame = plr:WaitForChild('PlayerGui')
local playerLeft = frame:WaitForChild('PlayerList')
local frame = playerLeft:WaitForChild('playerlist')
playerLeft(plr, frame)
end)```