Need Help With Making Crouch Thing

So I been trying to make it so that if you’re on the ground and then you crouch it sets your ply:SetViewOffsetDucked(Vector( 0, 0, 47 )) and if you’re in the air it is ply:SetViewOffsetDucked(Vector( 0, 0, 47.5 ))

I tried this by doing:


	if ply:IsOnGround() then
		ply:SetViewOffsetDucked(Vector( 0, 0, 47 ))
	else
		ply:SetViewOffsetDucked(Vector( 0, 0, 47.5 ))
	end

In GM:PlayerSpawn.

But it’s not working… any help? Thanks for reading

[editline]31st October 2015[/editline]

FUCK ME I GOOFED IM REALLY DUMB FIXED