How to spawn entities automatically on server start?

Hello all!

I’m hosting a cinema server and I want to add an entity which will spawn on the map after the server is started. It’s a jukebox which plays songs when you press the “Use” button on it. I need the jukebox to stay in the cinema lobby and make players unable to push it across the map. Usually I spawn the jukebox with the ULX menu, then move and fix it with a physgun, which is annoying. So, how do I avoid such a procedure and make the entity spawn automatically on server start?

hook.Add("InitPostEntity", "spawnent", function()

    local ent = ents.Create("yourent")
    ent:SetPos(Vector(0, 0, 0))
    ent:SetAngles(Angle(0, 0, 0))


Just change up the pos and angles to your preference.

Thanks, it helped me. But there is one issue: I can move it by pushing. How to fix it?



this freezes the entity as long as it has a valid physics object associated with it, but if it is moved with the physgun it will have motion enabled again. to disable it moving at all use


this will make the entity static, it will have no physics, and can still be moved with the physgun, but it will be frozen when you let go of it again

That worked, thank you too.