So I'm not very good at this and I've searched all over!
I'm wanting a prop to auto spawn on players backs ( for my zombie server )
I tried making the prop into an entity and got these errors-
It will spawn, but it is invisible and nothing can be done to it then this error shows in console~
[ERROR]
[ERROR] addons/backpack/lua/entities/ent_backpack/init.lua:6: attempt to index global 'self' (a nil value)
1. unknown - addons/backpack/lua/entities/ent_backpack/init.lua:6
2. Spawn - [C]:-1
3. SpawnFunction - gamemodes/base/entities/entities/base_entity/init.lua:77
4. Spawn_SENT - gamemodes/sandbox/gamemode/commands.lua:609
5. unknown - gamemodes/sandbox/gamemode/commands.lua:674
6. unknown - lua/includes/modules/concommand.lua:54
[MY SCRIPT]
[INIT.LUA FILE]
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include( "shared.lua" )
function ENT:Initialize()
self:SetModel( "models/fallout3/campish_pack.mdl" )
self:PhysycsInit( SOLID_VPHYSICS )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
self:SetUseType( SIMPLE_USE )
Self:DrawShadow( false )
end
function ENT:Think()
local owner=self:GetOwner()
if owner==NULL then return end
local bone=owner:LookupBone("ValveBiped.Bip01_Spine")
if(bone)then
local position,angles=owner:GetBonePosition(bone)
angles:RotateAroundAxis(angles:Forward(),0)
angles:RotateAroundAxis(angles:Right(),-90)
angles:RotateAroundAxis(angles:Up(),0)
self.Entity:SetPos(position+(angles:Up()*-7)+(angles:Forward()*
)
self.Entity:SetAngles(angles)
end
end
I NEED URGENT HELP PLEASE
!