Page 1 of 1

Spawn entity and attach to player?

Posted: Fri Jan 20, 2017 6:54 am
by you171717
Hello,

I want attach prop(hat) to player in tf2.

But code doesn't work properly (even spawning prop).

Syntax: Select all

target = Player(1)
entity = Entity.create('prop_physics')
entity.model = Model('props_junk/wood_crate001a.mdl')
entity.spawn()
entity.teleport(target.origin)

Re: Spawn entity and attach to player?

Posted: Fri Jan 20, 2017 7:18 am
by L'In20Cible
The function you are looking for is Entity.set_parent.

Re: Spawn entity and attach to player?

Posted: Fri Jan 20, 2017 7:41 am
by you171717
L'In20Cible wrote:The function you are looking for is Entity.set_parent.


'set_parent' function make prop invisible

is this trick of tf2? :p

Re: Spawn entity and attach to player?

Posted: Fri Jan 20, 2017 7:43 am
by L'In20Cible
What is your complete code?