Client-Side created entities doesn't exist

[lua]
local ent = ents.Create(“prop_physics”)
ent:SetModel(“models/myproject/mymodel.mdl”)
ent:SetPos(LocalPlayer():GetPos() + Vector(0,12,0))
ent:Spawn()
Msg("ID: “…ent:EntIndex()…”
")
[/lua]
Msg outputs: -1
“ent” returns NULL Entity

I really don’t get why it doesn’t work…
It perfectly works creating Server-Side.

and how a “predicted” entity works ? I know there a few entities predicted, such as the vehicles, player movement…

**[G.ClientsideModel

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

Damn! How I haven’t seen that function before!?
thanks anyway…

edit:
Still doesn’t work…

Clientside models are affected by the garbage collector, store them in a table or something.

[lua]
b_CEnt = ClientsideModel(“models/myproject/mymodel.mdl”, RENDERGROUP_OPAQUE)
b_CEnt:SetPos(LocalPlayer():GetPos() + Vector(0,12,0))
[/lua]

Still returns NULL Entity…

Isn’t that expected behavior? Ent indices are the same client and server-side so if you create a client-side only entity it gets an ent index of -1 to not mess up the system.
Does it error when you call :SetPos etc?

Yep, “Tried to use NULL Entity”