Hello Friends. Thank you in advance for your support.
I am planning to create a "trivial pursuit"-like game on Roblox. I have noticed that from from any script I can create a "part" using the "instance.new" call.
The part will create, and I can set the size, position etc in real time, from any script anywhere. However, I want to create Textbuttons from a script (or localscript) and modify its attributes from anywhere too, but only works if the script parent is the button itself.
As an example, I would like to create a textbutton for each player in a game. I need to count the players first, and then create as many buttons as players exist. However I cannot make the buttons appear in screen. Here is the code I use to create the buttons from a script in inside "ScreenGui":
local boton = Instance.new("TextButton",game.StarterGui.ScreenGui)
boton.Name="testing1"
boton.AnchorPoint = Vector2.new(0.5, 0.5)
boton.Position = UDim2.new(0.5, 0, 0.5, 0)
boton.Visible=true
boton.Size=UDim2.new(0,200,0,100)
boton.Text="Testing"
print (boton.Text)
The boton Textbutton creates itself, it set the proper parameters to it, but you can see nothing on the game screen. Is like the button is hidden or ... just doesnt show anything.
Do you know what am I doing wrong? (note that the print output in the last line prints "Testing")
Thank you again.

2 comments
Please put your code inside of code blocks.
Place the button inside of PlayerGui, not StarterGui. StarterGui will replicate to PlayerGui when the player joins/resets. So do “game.Players.LocalPlayer.PlayerGui.ScreenGui” when you’re parenting the TextButton.