Why does my FPS drop immediately upon adding a button to my HUD?

Hello,

I recently added a button to my HUD, that when pressed, returns the player to the hub server.



	local DButton = vgui.Create( "DButton" )
		DButton:SetPos( 307, 1035 )
		DButton:SetText( "Return to Hub Server" )
		DButton:SetSize( 120, 20 )
		DButton.DoClick = function()
			LocalPlayer():ConCommand("connect <iphere>")
	end


As soon as I save and the lua refresh occurs, my FPS gradually decreases until it is unplayable. The button, however, works fine.

Why would this happen?

Post the full code - you’re probably adding it in Paint or something.

That was the problem, moved it to its own section and it worked fine.
It kept looping and creating a million of those buttons, causing the FPS drop.
Thanks!