How to stop client freezing window glitch?

This topic explains what the glitch is:

I wanted to stop this but it didnt work at all.

This is what I tried:

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local HumanoidRootPart = character.HumanoidRootPart
		local FreeFalling = false
		character.Humanoid.FreeFalling:Connect(function()
			print("Free Falling")
			local PreviousPos = HumanoidRootPart.Position
			
			wait(5)
			local CurrentPos = HumanoidRootPart.Position
			
			if PreviousPos == CurrentPos then
				player:Kick("Stop cheating")
			end
		end)
	end)
end)

Is there a better way to do it that works?

Do periodic position checks and detect if someone is stuck in the air. HumanoidStates won’t be helpful here.

that will kick everyone who is loading up a bit longer than usual as well, there is no essential fix for this aside from roblox fixing how it works

You shouldn’t kick anyone ever with serversided checks.