Invisible player?

So I am not exactly sure what causes this effect.



function GM:EntityTakeDamage( ent, dmginfo )
	ent.entpos = ent:GetPos()
	ent.entmdl = ent:GetModel()
	ent.entskin = ent:GetSkin()
	if ent:IsPlayer() then
		ent:CreateRagdoll()
		curHealth = ent:Health()
		dmg = dmginfo:GetDamage()
		testdmg = math.abs(curHealth - dmg)
		print(testdmg)
		if math.abs(curHealth - dmg) >= 50 and curHealth - dmg <= 0 then
			ent:GetRagdollEntity():SetPos(ent.entpos)
			ent:Spectate(6)
			ent:SpectateEntity(ent:GetRagdollEntity())
			ent:SetParent(ent:GetRagdollEntity())
			ent.IsUnconscious = true
			net.Start("unconscious_start")
				net.WriteInt(testdmg, 32)
			net.Send(ent)
			timer.Create("unconscious_end", math.abs(curHealth - dmg) / 3, 1, function()
				net.Start("unconscious_end")
				net.Send(ent)
				ent:Spectate(0)
				ent:SpectateEntity(nil)
				ent:UnSpectate()
				ent:SetParent( nil )
				timer.Simple(1, function()
					ent:Respawn()
				end)
				timer.Simple(1.25, function()
					ent:Respawn()
				end)
				timer.Simple(1.5, function()
					net.Start("unconscious_disable")
					net.Send(ent)
				end)
				local body = ent:GetRagdollEntity()
				local eyes = body:GetAttachment( body:LookupAttachment( "eyes" ) )
				ent:SetPos(eyes.Pos)
				ent:GetRagdollEntity():Remove()
				timer.Simple(1.75, function()
					ent:SetModel(ent.entmdl)
					ent:SetSkin(ent.entskin)
					ent:RestartGesture( ACT_IDLE )
				end)
			end)
		else
			ent:GetRagdollEntity():Remove()
		end	
	end
end


I tried reseting player’s model and I tried a function that I randomly found but none of these work…

Edit:
Here is a screenshot http://imgur.com/a/leKU2 Yes, I am infront of the camera

player:CreateRagdoll() function sets position, velocity, angle by default. the problem is wiki says it is used for death ragdoll which is clientside. I suggest you creating ragdoll by yourself. When does player get invisible though? While spectating?

After this timer



timer.Simple(1.25, function()
    ent:Respawn()
end)


I used setpos because when I create it it randomly spawns at the top of the map (gm_flatgrass)
Edit:
btw it still doesn’t work (setting position)

for respawning players, use player:Spawn() instead. wiki says for ent:Respawn();


Makes the entity/weapon respawn.

Only usable on HL2 pickups and any weapons. Seems to be buggy with weapons. Very unreliable.


W-w-wait what? I tried this before, but I tried again… and it works, idk how. And can I ask, what class do I need to use to create a ragdoll?

prop_ragdoll

tanks :cat: