How do I randomize functions?
I am trying to call the functions randomly. But I do not know where to start. Any tips on how to begin? I have tried using math.random but no success.
01 | local paper = game.ReplicatedStorage.Spawnables.Paper |
02 | local folder = game.ReplicatedStorage.Spawnables |
06 | local spawnPaper = paper:Clone() |
07 | spawnPaper.Parent = workspace |
08 | local xpos = math.random(- 100 , 100 ) |
10 | local zpos = math.random(- 100 , 100 ) |
11 | spawnPaper.Position = Vector 3. new(xpos, ypos, zpos) |
14 | local spawnPaper = folder.VoidPaper:Clone() |
15 | spawnPaper.Parent = workspace |
16 | local xpos = math.random(- 100 , 100 ) |
18 | local zpos = math.random(- 100 , 100 ) |
19 | spawnPaper.Position = Vector 3. new(xpos, ypos, zpos) |
22 | local spawnPaper = folder.RedPaper:Clone() |
23 | spawnPaper.Parent = workspace |
24 | local xpos = math.random(- 100 , 100 ) |
26 | local zpos = math.random(- 100 , 100 ) |
27 | spawnPaper.Position = Vector 3. new(xpos, ypos, zpos) |
30 | local spawnPaper = folder.LightPaper:Clone() |
31 | spawnPaper.Parent = workspace |
32 | local xpos = math.random(- 100 , 100 ) |
34 | local zpos = math.random(- 100 , 100 ) |
35 | spawnPaper.Position = Vector 3. new(xpos, ypos, zpos) |
38 | local spawnPaper = folder.GoldPaper:Clone() |
39 | spawnPaper.Parent = workspace |
40 | local xpos = math.random(- 100 , 100 ) |
42 | local zpos = math.random(- 100 , 100 ) |
43 | spawnPaper.Position = Vector 3. new(xpos, ypos, zpos) |
45 | function DiamondPaper() |
46 | local spawnPaper = folder.DiamondPaper:Clone() |
47 | spawnPaper.Parent = workspace |
48 | local xpos = math.random(- 100 , 100 ) |
50 | local zpos = math.random(- 100 , 100 ) |
51 | spawnPaper.Position = Vector 3. new(xpos, ypos, zpos) |
53 | function EmeraldPaper() |
54 | local spawnPaper = folder.EmeraldPaper:Clone() |
55 | spawnPaper.Parent = workspace |
56 | local xpos = math.random(- 100 , 100 ) |
58 | local zpos = math.random(- 100 , 100 ) |
59 | spawnPaper.Position = Vector 3. new(xpos, ypos, zpos) |
61 | function PurplePaper() |
62 | local spawnPaper = folder.PurplePaper:Clone() |
63 | spawnPaper.Parent = workspace |
64 | local xpos = math.random(- 100 , 100 ) |
66 | local zpos = math.random(- 100 , 100 ) |
67 | spawnPaper.Position = Vector 3. new(xpos, ypos, zpos) |