Was working on some silly things to add to my pointshop on my server and came across some problems. I have added a medpack that one can wear on their back, and I’m looking to have it so that wearer of the backpack has either a bit of extra starting health (shown code attempt) or has a slight health regeneration over time (tried multiple times, gave up, deleted it). Can anyone take a look and see what’s wrong?
ITEM.Name = 'Medpack' ITEM.Price = 7500 ITEM.Model = 'models/Items/HealthKit.mdl' ITEM.Bone = 'ValveBiped.Bip01_Spine2' function ITEM:OnEquip(ply, modifications) ply:PS_AddClientsideModel(self.ID) end function ITEM:OnHolster(ply) ply:PS_RemoveClientsideModel(self.ID) end function ITEM:ModifyClientsideModel(ply, model, pos, ang) model:SetModelScale(0.8, 0) pos = pos + (ang:Right() * 5) + (ang:Up() * 6) + (ang:Forward() * 2) return model, pos, ang end function ITEM:Think(ply, modifications) if ply:Alive then ply:SetMaxHealth(110) end end
The error I’m getting is
[ERROR] addons/pointshop-master/lua/items/accessories/medpack.lua:22: function arguments expected near 'then' 1. unknown - addons/pointshop-master/lua/items/accessories/medpack.lua:0
I’m rather new to lua, so I understand at least the location where the error is near, but can’t exactly find the error itself. If someone could lead me to fix it, or help me out instead with the regeneration pathway I really wanted to take instead, that’d be great