Creating an Entity on another "entity"?

Hello.
I am making this entity that when broken, creates a prop, and then that prop creates an entity. Although i’m having trouble doing so. Currently i am creating the entity by checking where the player is looking, but thats not the most effective way because the player wont be looking at the prop at all times. So how can i create the entity on the prop it spawns?

heres the code so you get an idea:
[lua]
local weapon = ents.Create(“prop_physics”)
weapon:SetModel(“models/props_junk/watermelon01.mdl”)
weapon:SetAngles(vAng)
weapon:SetPos(vPoint - vAng:Forward() * 20 + vAng:Up()*30)
weapon:SetCollisionGroup( COLLISION_GROUP_INTERACTIVE )
weapon:Spawn()
weapon.Debris = 1
timer.Simple( 3, function() local ply = Entity(1) local tr = ply:GetEyeTrace() local ent = ents.Create(“item_surprise_explode”) ent:SetPos(tr.HitPos) ent:Spawn() end)
[/lua]

Thanks!

Why don’t you use weapon:GetPos()?

That is your answer, OP.
Don’t forget to put in a check whether the weapon entity is still valid, as in:
[lua]
timer.Simple(3, function()
if not IsValid(weapon) then
return
end

 // your code

end);
[/lua]

It’s also worth noting that Entity(1) will only work as you expect in single player.

Thank you both! I completely blanked out for a bit but your answer(s) were perfect!