How to detect if player is colliding with a trigger 5 seconds?

If player was staying in trigger 5 seconds destroy player, if he was staying less then 5 seconds or left the trigger before 5 seconds do nothing.

You can set a variable in the player, that tells you if he is in the trigger right now, that you set to true when he enters, and false when he leaves. You can then in the tick function check if you are inside the trigger, and if so add the DeltaTime to another variable. Every tick will add to this variable, so it represents the exact time that you have been inside the trigger. You can then check also in the tick function if this variable is greater than 5. If so destroy the player, if not do nothing. You also have to set that variable to 0 again once you leave the trigger. That should do the trick.

You can implement the overlap begin event and start a 5 sec retriggerable timer with a gate behind it. Then implement the overlap end event and close the gate. That way, when the player leaves the trigger, the gate is closed and the code behind it won’t be executed when the timer finishes. You have to use the retriggerable one for when the player leaves the trigger and enters again. Dont forget to also open the gate again before you start the timer. Heres a quick example: