Loop all players sends it 1000 times! Help!

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Centrect

Member
Jul 23, 2020
1
0
1
24
So, i've got the basic code down that will send a message when a variable is greater than or equal to 2000. In practise, it sends it 3000 times and that is really annoying, how would I fix this?

every second:
loop all players:
if {level::%loop-player's uuid%} >= 2000:
send "&bCongratulations! You are now eligible to prestige! Begin with /prestige!" to loop-player
[doublepost=1595502121,1595499267][/doublepost]btw i know the indentation is wrong, its right in code but skforums makes it look weird
 
Try not to use periodicals, instead, you should use while loops. Periodicals triggers unnecessarily and causes lag
 
Code:
every minute: #I would NOT recommend you looping all players every second :D
    loop all players:
        if {level::%loop-player's uuid%} >= 2000:
            if {prestigemessage::%loop-player's uuid%} is not set:
                send "&bCongratulations! You are now eligible to prestige! Begin with /prestige!" to loop-player
                set {prestigemessage::%loop-player's uuid%} to true
 
Status
Not open for further replies.