Sold Props

I’m currently using a code that spawns a prop, it spawns perfectly fine but I can’t seem to get the prop to go solid, how do I do this please?

Sorry for title typo.

Post the code you’re using. You should be using the following on a prop_physics

Entity:SetMoveType(MOVETYPE_VPHYSICS)
Entity:SetSolid(SOLID_VPHYSICS)

That didn’t seem to help,



local lootbox = ents.Create("prop_physics")
lootbox:SetModel("models/props_junk/cardboard_box002a.mdl")
lootbox:SetPos(npcTarget:GetPos()+ Vector(0, 0, 30))
lootbox:SetOwner(entKiller)
lootbox:SetMoveType(MOVETYPE_VPHYSICS)
lootbox:SetSolid(SOLID_VPHYSICS) 
lootbox:Spawn()
timer.Simple(10, function()
		lootbox:Remove()
end)


And for some reason now spawned 2x props

Just noticed, you’re setting the player as the owner, which will disable collisions. Do you need the entity to have an owner? And you’ll need to ensure the entity is only created in one environment, so use something like this:

[lua]
if SERVER then
local lootbox = ents.Create(“prop_physics”)
lootbox:SetModel(“models/props_junk/cardboard_box002a.mdl”)
lootbox:SetPos(npcTarget:GetPos()+ Vector(0, 0, 30))
–lootbox:SetOwner(entKiller)
lootbox:Spawn()
lootbox:Activate()
timer.Simple(10, function()
lootbox:Remove()
end)
end
[/lua]

That worked perfectly thank you, how would you go about identifying this specific prop, for instance this is in a shared file and can I do lootbox.IsLoot = true then in HUD paint do a check on the prop such as,

if ent.IsLoot then
//draw name
end

And the final issue is can I call a menu saved in clientside from shared files?

Thank you again mate, I appreciate the help

Yep you should be able to do that, and to call clientside functions from the server you need to use Console Commands or User Messages.