Observer mode?

I would greatly appreciate it if someone could make me something where whenever someone noclips they turn invisible until they leave noclip, I’m new to lua and I’ve been looking for this, thanks <3

Something like this maybe?



local function NoclipInvis (ply, state) 
	if ( state ) then
		local invis = Color(0, 0, 0, 0)
		ply:SetColor(invis)
	else 
		local color = Color(255, 255, 255, 255)
		ply:SetColor(color)
	end
end
hook.Add("PlayerNoClip", "NoclipInvis", NoclipInvis)


Thanks, but where would I put that?

lua/autorun maybe?

I’m gonna be honest, I’m not too sure. I’m not that familliar with Lua but I think that’s where you want to put it.