Problem with ui pls help

hey guys so im creating a new label when a player joins but the label is not created in accordance with the ui list layout i have in my frame, here is the script:

local remotes = require(game.ReplicatedStorage.BridgeNet)
game.Players.CharacterAutoLoads = false

game.Players.PlayerAdded:Connect(function(player)
	
	player:LoadCharacter()
	
	task.delay(.2, function()
		local ui = player.PlayerGui

		local playerlist = ui.PlayerList.Frame
		local name = Instance.new("TextButton") ; name.Parent = playerlist ; name.Text = player.Name
	end)
	
	player.CharacterAppearanceLoaded:Connect(function(character)
		local humanoid: Humanoid = character:WaitForChild("Humanoid")
		humanoid:RemoveAccessories()
	end)
	
	local character = player.CharacterAdded:Wait()
	if character then
		
	end
end)


so the textbutton is created but its created in a weird place:


if u cant see it then look at the top left corner of the frame.

here is how i’ve added the uiListLayout:
image
honestly first time ive encountered this someone plz help me thanx

It’s under a parent frame containing a “UIListLayout” child. That’s the reason for the positioning issue.

Now addressing the other issue, your button does not have any Size property to it. I’m not 100% sure why this is, since afaik they default to UDim2.new(0,200,0,50) like new parts default to V3(4,1,2)

But that’s all I can tell you.
Your UIListLayout’s properties are the reason for the position, and you need to add a Size declaration when you make the “name” button in your code.

Additionally: I stand corrected, they do not default to 0,200,0,50 when created using Instance.new()

They instead default to 0,0,0,0 for some odd reason. (Thanks Roblox?)
Anyways, read my previous reply it should assist you in solving this with those pieces of info.

thanks my friend this helped me out

however this does not happen when i manually add a new textbutton into the frame with the uiListLayout and thats whats confusing me

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.