So script works perfectly fine, but every time it does it's part there appears an error in console which is says this:
attempt to call method 'SetArmor' (a nil value)
Here's the code
local function ArmorRegeneration ()
for k,v in pairs( player.GetAll() ) do
if (v:IsValid()) then
if v:Alive() and v:Armor() < 150 and ( !v.lastregen or v.lastregen < CurTime() - 1 ) then
v.lastregen = CurTime()
v:SetArmor( v:Armor() + 1 )
end
end
end
end