Frozen car teleport after unfroze

I’m trying to make so shooting at a car freezes it for 3 seconds:


			local tr = self.Owner:GetEyeTrace()
			local trent
			local trentpos
			if tr.Entity:IsVehicle() then
			trent = tr.Entity
			trentpos = tr.Entity:GetPos()
			trent:SetMoveType(MOVETYPE_NONE)
			timer.Create("asd", 3, 1, function() unfreezecar(trent, trentpos) end)
			end


function unfreezecar(trent, trentpos) 
	trent:SetMoveType(MOVETYPE_VPHYSICS)
	trent:SetPos(trentpos)
end

What happens currently is that I shoot it once, and then it cant move for 3 seconds, but if the person inside is holding down W, after 3 seconds, the car is teleported to where it would’ve been if it wasn’t frozen. I try to fix it with the position there but it doesn’t work.

Bump, I think it’s necessary to use phys, but I’m not sure how.

Have you tried trent:GetPhysicsObject():EnableMotion(false) to freeze the car and trent:GetPhysicsObject():EnableMotion(true) to unfreeze it? That’s the “proper” way to freeze a physics object, you shouldn’t change the move type.

Yes, and you must call those functions for every physics object that vehicle has.

Thank you, I have tried it in a new thread, see my latest response here please:
http://forum.facepunch.com/showthread.php?t=1304080

Could you tell me how to do that?