Changing a textbox position

Hi i am trying to script it so when a player joins the game their name will appear on a part. I did the script and it works but i am unable to make it so the position changes everything a new player joins

this is the script

game.Players.PlayerAdded:Connect(function(name)
local imaine = name.Name
local surface = script.Parent.SurfaceGui
local outsite = 500
local something = 0
local num = 50

local more = Instance.new("TextLabel")
more.Text = imaine
more.BackgroundTransparency = 0
more.Size = UDim2.new(something,outsite,something,num)
more.Parent =  surface
more.TextScaled = true

end)

I am able to make the textbox show the name of the player but if there is more than one person the textbox stays in the same place.

A pciture

You can change the position by setting the .Position property. To calculate the position, I would recommend multiplying the number of children in the SurfaceGui by the size of the TextLabel.

2 Likes

you should just use UIListLayout | Documentation - Roblox Creator Hub (or grid, idk whats your case) instead of manually setting the position

2 Likes