How would I make a conditional AFK damager?

I have searched for this on YouTube and forums but it’s mostly talking about exploiter scripts. I need to make a script that damages players whilst afk and while another condition is met. I spent about two hours and am unsuccessful. All help is appreciated.

You could try using the Player.Idled event.

    print(Player.Name.." has been idle for "..IdleFor.." seconds!")

The above solution will work fine, but why do you want to damage afk players?

To ensure they are moving during a running game