Using an entity to freeze then unfreeze a player

Hey everyone.
I would like to be able to press use on my entity, have the player freeze for five seconds, and have the player then unfreeze, all while adding a value to that SPECIFIC player (NOTE: I do not want the player to receive the value or have the entity disappear if they die while frozen).

Here’s my code so far:


function ENT:Use( activator, ply, useType, value )
	ply:Freeze( true )
	timer.Create( "Collection Timer", 5, 1, function() TimerDone() end)
end

Any help is appreciated :slight_smile:


function ENT:Use( activator, ply, useType, value )
	ply:Freeze( true )
	timer.Simple( 6, function() ply:Freeze( false) if(ply:IsAlive()) then ply:SetNWInt("YourValue",69) end end)
end

Note: If you use ply:freeze(), then they won’t be able to die. They’ll still be frozen even when dead.

In the console it says IsAlive is a nil value

[editline]24th April 2016[/editline]

Nevermind xD. the class is “Alive” not “IsAlive”