Set Player invisible for darkrp in swep

I am trying to make a swep that turns a player invisible with PrimaryAttack,
but althought I havent tested, I am sure using LocalPlayer():SetColor(0,0,0,0) will only turn his playermodel invisible
but the job tags or healthbar that is hovering above his head is still visible after being turned invisible

How can I work around this?


function SWEP:PrimaryAttack()

	if ( CLIENT ) then return end

    LocalPlayer():SetColor(0,0,0,0)


end


Seeing as you are using DarkRP, you could use the cloak command: https://github.com/FPtje/DarkRP/blob/353dc3286092cdb2efade2cc0f2145db5a6c2e69/gamemode/modules/fadmin/fadmin/playeractions/cloak/sv_init.lua

That code shouldn’t work at all: LocalPlayer is clientside only. But anyway, you should be using SetNoDraw.

havent done lua in a few months, how do I correctly call the swep owner ?


function SWEP:PrimaryAttack()

	if ( CLIENT ) then return end
    if self:GetNoDraw() = false then
      drawing = true
    else 
      drawing = false
    end
    self:SetNoDraw(drawing)
end

its just self.Owner

Okay thanks! Works now, but is there also a way to stop the player from making step sounds?