Making a Player Invisible

Thread title. I’ve tried using:



player:SetColor(0,0,0,0)
player:Fire("alpha","0","0")


And I don’t want to set the material to that one semi-transparent material, as I require complete invisibility.

Ideas?

Have you tried Player:AddEffects( EF_NOSHADOW | EF_NODRAW )?

Can remove them later with RemoveEffects() to make something visible again.

Taken from ULib/ULX :

[lua]
local function doInvis()
local players = player.GetAll()
local remove = true
for _, player in ipairs( players ) do
local t = player:GetTable()
if t.invis then
remove = false
if player:Alive() and player:GetActiveWeapon():IsValid() then
if player:GetActiveWeapon() ~= t.invis.wep then
timer.Simple( 0.05, ULib.invisible, player, true, t.invis.vis )
t.invis.wep = player:GetActiveWeapon()
end
end
end
end

if remove then
	hook.Remove( "Think", "InvisThink" )
end

end

function ULib.invisible( ply, bool, visibility )
if not ply:IsValid() then return end – This is called on a timer so we need to verify they’re still connected

if bool then
	visibility = visibility or 0
	ply:DrawShadow( false )
	ply:SetMaterial( "models/effects/vol_light001" )
	ply:SetRenderMode( RENDERMODE_TRANSALPHA )
	ply:Fire( "alpha", visibility, 0 )
	ply:GetTable().invis = { vis=visibility, wep=ply:GetActiveWeapon() }

	if ply:GetActiveWeapon():IsValid() then
		ply:GetActiveWeapon():SetRenderMode( RENDERMODE_TRANSALPHA )
		ply:GetActiveWeapon():Fire( "alpha", visibility, 0 )
		ply:GetActiveWeapon():SetMaterial( "models/effects/vol_light001" )
		if ply:GetActiveWeapon():GetClass() == "gmod_tool" then
			ply:DrawWorldModel( false ) -- tool gun has problems
		else
			ply:DrawWorldModel( true )
		end
	end

	hook.Add( "Think", "InvisThink", doInvis )
else
	ply:DrawShadow( true )
	ply:SetMaterial( "" )
	ply:SetRenderMode( RENDERMODE_NORMAL )
	ply:Fire( "alpha", 255, 0 )
	ply:GetActiveWeapon():SetRenderMode( RENDERMODE_NORMAL )
	ply:GetActiveWeapon():Fire( "alpha", 255, 0 )
	ply:GetActiveWeapon():SetMaterial( "" )
	ply:GetTable().invis = nil
end

end[/lua]

Thank you both. I’m sure it’ll work well.

hi is possible for Team_ ?
thx for reply

Look at the date of the last post this thread is almost 7 years old.

I see this but I look for code work

I starded this thread http://forum.facepunch.com/showthread.php?t=1512187

but I look for remove SetMaterial can change Team