Attempt to call method 'UniqueID' (a nil value)

When I call the line:


In lua\autorun\client\file.lua I get ‘attempt to call method ‘UniqueID’ (a nil value)’

What have I done wrong?

Where are you calling this? The client entity has to be initialized first.

GM:InitPostEntity is called once all entities (including the client) have initialized.

It is literally the first line in the script.

I already thought about something like that. Let me try if this helps

LocalPlayer isn’t valid during loading – you will have to use a hook. Also, I would use AccountID or SteamID since UniqueID is prone to collisions.

Thank you, the hook fixed it for me. And you were right, SteamID works way better.