When I move my anim, the physgun beam is always placed in spawn point. I woke up physics, activated entity, but nothing works. The only file is “shared.lua”. How do I fix that?
Show us your code. (Use [noparse][lua][/lua][/noparse] tags!)
function ENT:SpawnFunction( ply, tr )
if !tr.Hit then return end
local NewTree = ents.Create(ClassName)
if SERVER then
if SERVER then
Initialize is a serverside function, you shouldn’t be calling those in shared.lua.
He is only running the code on server tho.
if Server then end means that the code in there only runs on server
The functions aren’t in an if statement from what I see…
>>you shouldn’t be calling those in shared.lua.
I’m making Toybox SENT. All Toybox SENTs are in one file.
And, “use” is not related to physgun. I initialize physics OUT of if SERVER end, and I wake physics up in SpawnFunction.
I get the feeling you’re meant to call entity.Spawn in the Initialise function. Worth trying, but don’t take it for granted (I haven’t made any entities in a large number of months)
Initialize is called by Spawn
Putting it in the shared folder is fine, he’s not calling the functions at all. (Sure they’re a waste of space but they don’t cause any trouble)
@SiPlus666 please show us your whole file, instead of just those 2 functions.
>>I get the feeling you’re meant to call entity.Spawn in the Initialise function.
I call entity:Spawn in SpawnFunction, not in Initialize. Read the code.
>>Sure they’re a waste of space but they don’t cause any trouble
In Toybox there is only ONE lua script can be posted.
Yes, now read the rest of my post so we can help you further.
Problem fixed - spawn and init should be called only on server.