CurTime wont work unless I'm just bad

I have coded something so when someone spawns it will god them. I have a var set to curtime + 30 but it seems to never work when its == curtime. It gets to the first part but not the last part. Any help would be appreciated.



local timeLeftForASK = 0

local function spawnProt( ply )
	print( "A Players ASK Started" )
	ply:PrintMessage( HUD_PRINTTALK, "[A.S.K] You have 30 seconds of spawn protection.
" )
	ply:GodEnable()
	timeLeftForASK = CurTime()+30
	if timeLeftForASK == CurTime() then
		print( "A Players ASK Ended" )
		ply:PrintMessage( HUD_PRINTTALK, "[A.S.K] Your spawn protection has ended.
" )
		ply:GodDisable()
	end
end

hook.Add( "PlayerSpawn", "Anti-Spawn-Kill", spawnProt )


As soon as a player spawns, the function spawnProt() is called, when spawnProt() is called, and the if statement is evaluated, CurTime() is not equal to CurTime() + 30. The way you would do it is to replace the if statement with a timer.



timer.Simple(30, function()
    print("A player's ASK Ended")
    ply:PrintMessage( HUD_PRINTTALK, "[A.S.K] Your spawn protection has ended.
" )
    ply:GodDisable()
end)


tl;dr you’re bad.

Yeah I am bad dont know why I didnt think of that thanks ;3