I am having a very frustrating problem, in order to attach something to an moving and/or animated model you need to use a while loop. Since a while loop has to have an wait in it, that attached model floats a frame behind, not sticking.
How do you guys properly attach an model such as a sword or a gun to a model?
That is probably cause the entity's animation (or movement or rotation) runs after the attachment function. Either run the attachment function after those functions (e.g. by removing the while from it and just call it every frame after those functions <- this is what I do) or use proc_mode in your attachment function. Hope that helps.
like reconnoiter said, you have to make sure that the code for attaching the object is called after the entity has been animated.
I'd do it like this:
create a function for attaching the object to your player model. you could use parameters to specify which object to attach aswell as the player model that it needs to be attached to.