local Players = game:GetService("Players") Players.PlayerAdded:connect(function(Player) for _,p in next, Players:GetPlayers() do script.Parent.ScrollingFrame:ClearAllChildren() local textButton = Instance.new("TextButton",script.Parent.ScrollingFrame) textButton.BackgroundColor3 = BrickColor.Black().Color textButton.BackgroundTransparency = 0.9 textButton.BorderColor3 = BrickColor.White().Color textButton.Positon = UDim2.new(2, 0, 1, 0) textButton.Size = UDim2.new(0, 200, 0, 25) textButton.Font = Enum.Font.ArialBold textButton.FontSize = Enum.FontSize.Size18 textButton.Text = p textButton.TextColor3 = BrickColor.White().Color textButton.Archivable = true end end)
When run, a textbutton should appear with the players name on it.
Nothing shows up.
Please help.
Please no Remote Events.
I'm not sure if you intentionally did this, but your script is littered with errors.
You made a typo. Positon
Trying to set the text to a player object textButton.Text = p
Everytime someone joins, it creates a new text button with the name of the player looking at it. So if I tested it in multiplayer, it would be 'Player1, Player1' and for the other player, 'Player2, Player2' textButton.Text = p.Name
You have a very dodgy position there. That is way off the SCREEN! Also, you will need to see which llines are taken and that, etc.
Unreadable text. Your background transparency is a bit off. 0.9
makes the white text almost unreadable. I set it to 0.1
because that looks better.
This is where the main issue is. Your PlayerAdded event is not firing. I tried putting it in Workspace
and then just tweaked the code, and it worked fine.
local Players = game:GetService("Players") game:GetService("Players").PlayerAdded:connect(function(Player) for _,p in pairs(Players:GetPlayers()) do local textButton = Instance.new("TextButton",p.PlayerGui:WaitForChild("PlayerList").ScrollingFrame) -- Replace PlayerList with the name of your gui. textButton.BackgroundColor3 = BrickColor.Black().Color textButton.BackgroundTransparency = 0.1 textButton.BorderColor3 = BrickColor.White().Color textButton.Position = UDim2.new(0, 0, 0, 0) textButton.Size = UDim2.new(0, 200, 0, 25) textButton.Font = Enum.Font.ArialBold textButton.FontSize = Enum.FontSize.Size18 textButton.Text = Player.Name textButton.TextColor3 = BrickColor.White().Color textButton.Archivable = true end end)
Thanks for reading my answer. I hope it helped you. If it did, don't forget to upvote it or set it as the correct answer!