I'm trying to make scripts execute in random order, kinda like horrific housing, sorry if this is a request it was my last choice.
a way you could do this is by having one central script, with a math.random function. like this:
1 | while wait( 10 ) do -- any number works |
2 | local number = math.random( 1 , 10 ) |
3 | if number = = 1 then |
4 | print ( "doing things" ) |
5 | elseif number = = 2 then |
6 | print ( "doing more things" ) |
7 | --and so on |
8 | end |
Use a ModuleScript. You can read more about them here.
Basically, make one parented to your regular script. then do something like:
01 | local modes = { } |
02 |
03 | function modes:Mode 1 () |
04 | --Code for mode 1 |
05 | end ) |
06 | function modes:Mode 2 () |
07 | --Code for mode 2 |
08 | end ) |
09 | function modes:Mode 3 () |
10 | --Code for mode 3 |
11 | end ) |
12 |
13 | --Repeat |
14 |
15 | return modes |
Then, in your regular server, do something along the lines of:
01 | local modeModule = require(script:WaitForChild( "The name of your module script here" )) |
02 |
03 | while true do |
04 | mode = math.random( 1 , the number of modes you have) |
05 | if mode = = 1 then |
06 | modeModule:Mode 1 () |
07 | elseif mode = = 2 then |
08 | modeModule:Mode 2 () |
09 | elseif mode = = 3 then |
10 | modeModule:Mode 3 () |
11 | end |
12 | end |
Hope this helps. Also I didn't test this, reply with errors!