Random integer

  • 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!

5jgk

New Member
Jan 3, 2024
7
0
1
24
So im tryna make a random integer thingy like this
This is my code

Code:
every 1 tick:
    set {_1} to 5
    set {_2} to 10
    set {_random} to random integer between {_1} and {_2}



every {random} minutes:
    loop all players:
        if "%region at loop-player%" contains "afk":

so idk how to do the random integer thing I want to make it so every random time in between 5 and 10 minutes you get an item
 
Hey, i believe there is more possible ways to do it but i made it through function.
Code:
function reset():
    set {_random} to random integer between 5 and 10
    wait "%{_random}% minutes" parsed as timespan
    loop all players:
        if "%region at loop-player%" contains "afk":
            #REST OF YOUR CODE
    reset()

on load:
    reset()
 
Last edited:
Hey, i believe there is more possible ways to do it but i made it through function.
Code:
function reset():
    set {_random} to random integer between 5 and 10
    wait "%{_random}% minutes" parsed as timespan
    loop all players:
        loop all players:
            if "%region at loop-player%" contains "afk":
                #REST OF YOUR CODE
    reset()

on load:
    reset()
So im getting this error

Line 6: There are multiple loops that match loop-player, Use loop-player-1/2/3/etc, to specify which loop's value you want.
 
this script does not work in the afk area and its not every 5-10 minutes? can you help?