Locking an entity to a player

How would i go about creating an entity that is linked to a player.
What I’m looking for is a way to make an entity that is parented to a player, so the entity will follow around the player without having to manual updating it position on the server.
Any help would be appreciated.

myent:SetParent(ply)

**[Entity.SetParent

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Entity.SetParent)**

This works very well but if said entity is visible it’s not going to be pretty.

Really its that simple? Nothing has even been that simple before.

Edit:
nice, thanks this is what i was looking for.

just by intrest, cause i am gonna use this same function, how would i link a varibla to the entity the player is looking at?

Whats a varibla?

I think he means variable, lol.

Bad spelling given

Assuming ply is a valid player entity :

local ent = ply:GetEyeTrace().Entity
ent.MyVariable = “My value”