GetOwner Help

Hi, need some help on the GetOwner function for an entity client side
For any entity, whenever I try GetOwner on it, it always returns a “[Null Entity]”. Is this because of the file being client side? If so are there any work arounds?

Hmm first what are you trying to do exactly? Also you should be aware that GetOwner doesn’t return the player that spawned the entity, but only what you set with SetOwner (which disables collisions between entities).

Ah, thank you, so how would I get the person owner of the entity?

Well if you want it to be easilly accessible by both the clients and the server you could do this :

Entity:SetNetworkedEntity(“Owner”, Player )

And you would retrieve it using Entity:GetNetworkedEntity(“Owner”)

Alternatively if it doesn’t have to be networked do this :
Entity.Owner = Player

Oh and to detect when a player spawns something look in the gamemode hooks section of the wiki.

Thank you!
It has helped me!