Is it possible to create a script that switches your team if you haven't used proximityprompts for too long?

I’m creating a system of Citizens, Criminals and Employees, where citizens do not make money, criminals make money by theft and cannot become employees (i plan to add more punishments for becoming a criminal) and employees are like citizens except every 5 seconds you make money as long as every 2 minutes or so you clean the tables (which i’ll use the proximitypromps for)
I’ve tried this but it’s COMPLETELY broken so i just wanted to know if this is possible to make or if you know how to make something similar

Yes, it is possible. Check when a proximityprompt is triggered, and set a value to 0. Every second that value will increase by one, and when it reaches a certain amount, say 120, then you stop paying them or whatever.

1 Like

i’ve tried this but it always either goes past the number it’s supposed to, doesn’t work at all or doesn’t reset when you activate it again, even when i specify that the number resets upon activation

May I see the scripts that handle this?

Keep a table of players that triggered the prompt and every second do a for loop and add +1 to it, the reset if the prompt is triggered and when the loop is running check if the time is higher than the threshold you want and then change the team