Spawn an entity when a derma button is pressed

I could use some help I have a Derma menu all set up but I want to be able to spawn entity when
a Derma button also I want the players to own the entity and be able to move it around with there phys-guns

Thanks for all you help

try something like this in it

util.AddNetworkString("Spawn prop")
net.Receive("Spawn prop", function( len, ply )
	 local prop = ents.Create( "prop_physics" )
	 prop:SetModel( "models/props_phx/cannonball_solid.mdl" )
	 prop:SetPos( ply:GetEyeTrace().HitPos )
end )

My bad I want to spawn things out of the entities tab not props

You could easily modify that for entities.
Note the call to ents.Create().

Clientside, inside the button:



util.AddNetworkString( "SpawnRequest" )

net.Receive( "SpawnRequest", function( length, client )
local data = net.ReadString()
if data == "Soldier" then SpawnCombineS(client:GetEyeTraceNoCursor().HitPos+Vector(0,0,30)) end

function SpawnCombineS( pos )
	NPC = ents.Create( "npc_combine_s" )
	NPC:SetKeyValue("NumGrenades", "2") 
	NPC:SetPos( pos )
	NPC:SetKeyValue( "ignoreunseenenemies", 0 )
	NPC:SetKeyValue( "spawnflags", 512 )

That’s how I do it.

For the players to own the prop, you could set a variable or NWString in the prop that is the player’s name, for example, and check it whenever you want to know the prop’s owner.

Thank you so much I was still having a bit of trouble but you helped a ton!