Set variable on ents.create entity.

I’m trying to set variable on ents.create entity.

But it should be a table so it can’t be NWVar I think?



local tab = {"hey","hey2"}
	local ent = ents.Create("some_entity")
	ent:SetPos(pos)
        ent.VarTable = tab
	ent:Spawn()

-- In ENT:Initialize or any ENT: function of some_entity

ENT:Initialize()
PrintTable(self.VarTable)
--nil
end









Are you printing clientside? Your vartable is not networked in this instance.

I tried it on server. But I want make it shared too.

It’s a bit hard to help you only with these 10 lines.
You need to share a bit more code. Are you coding in a gamemode environment or just coding an entity?

It’s an addon. I think I was clear.

I just want get a table from server to use it in entity clientside and serverside both.

Why I am not creating table in entity, you may ask.

It’s up to situation and it has to be in that server file.

You need to send it to the client.

If you want to send a table … go with the net libary.

Create some code that will sync the table.

Or use the Ent:SetNW<type>(name,varable) (Like

Entity:SetNWString)
This doesn’t support tables tho.

Well, I told it doesnt support anyway. I am already using net on ent use.