Anti Exploit False Positive!

Hello, so I am trying to patch something in my game: hookfunctions.
I do this by using integrity checks BUT the check false positives, this script is open sourced and can be found here.

But this is what I’m doing:

function kickplayer() --the name of the function being hooked
	local x = 	game.Players.LocalPlayer:Kick() -- the expected/normal output
	return x
end 

--Anti FunctionHook
--Integrity check the vulnerable function:
coroutine.resume(coroutine.create(function() 
	while wait(4) do
		if kickplayer() ~= game.Players.LocalPlayer:Kick() then 
			game.Players.LocalPlayer:Destroy();
		end
	end    
end))

it kicks right when I join after 4 seconds, why is this?

Because you’re calling the function in the if statement, which kicks the player.

so what should I put it to? If I remove it from the if statement it won’t work.

I have no idea how hookfunctions work, but I’m fairly certain an exploiter could bypass any anti-exploit as long as it is on the client.

I mean how would I make it so it’s not in the if statement but still work?

Index Kick function (.Kick) and don’t call it.