Random generator every round

So I have 5 scripts all in a folder in serverscriptservice. They are all module scripts and they ware creating a new scenario every few rounds. How could I make them select a new one after every round instead of after a random amount of rounds.

script 1:
local AllEvents = {

["Hell"] = {
	"Explode All",
	"Invisibility",
	"Poison",
	"Blur",
	"Fog"
},

["Heaven"] = {
	"Win All",
	"Package Of Goods",
	"Package Of Lottery",
	"Invincibility",

},

["Package Of Lottery"] = {
	"Win All",
	"Extra Time",
	"Invincibility",
	"Low Gravity",
	"High Speed",
	
	
},

["Package Of Goods"] = {
	"Extra Time",
	"Invincibility",
	"Low Gravity",
	"High Speed",
}

}

return AllEvents

script 2:
local Event = {}

function Event.CallEvent(eventname, Val1, Val2,Val3,Val4)

game.ReplicatedStorage[eventname]:FireAllClients(Val1,Val2,Val3)	

end

return Event

script 3:
local EventFunction = {}
EventFunction.__index = EventFunction

local AllEvents = require(script.Parent.AllEvent)

function EventFunction.new(main)
local self = setmetatable({}, EventFunction)

self.Main = main

local currentStage, currentEvent = self.Main.ChoosenOne, self.Main.choosenmutate

if game:GetService("ReplicatedStorage").Mutators:FindFirstChild(currentEvent) then 
	game:GetService("ReplicatedStorage").Mutators:FindFirstChild(currentEvent).Value = true
else
	for _, v in ipairs(AllEvents[currentEvent]) do
		game:GetService("ReplicatedStorage").Mutators:FindFirstChild(v).Value = true

	end
end

return "Done"

end

return EventFunction

script 4:
local HeavenAndHell = {}
HeavenAndHell.__index = HeavenAndHell

local RandomizedEvent = require(script.Parent.RandomizedEvent)
local EventCall = require(script.Parent.CallEvent)

local AllEvents = require(script.Parent.AllEvent)
local EventsFunction = require(script.Parent.EventsFunction)

local Colors = {

Heaven = Color3.fromRGB(255, 255, 255),
Hell = Color3.fromRGB(170, 44, 2)

}

function HeavenAndHell.new()
local self = setmetatable({}, HeavenAndHell)
self.ChoosenOne = RandomizedEvent.new({“Heaven”,“Hell”})
EventCall.CallEvent(“MessageEvent”,“The King Of “…self.ChoosenOne…” Has Bestowed Upon The Tower”, Colors[self.ChoosenOne], “rbxassetid://5893607560”)
EventCall.CallEvent(“NotificationEvent”,“The King Of “…self.ChoosenOne…” Has Bestowed Upon The Tower”, 4)
wait(3)

self:InformInformation()

EventsFunction.new(self)

return self

end

function HeavenAndHell:Init()

end

function HeavenAndHell:InformInformation()

self.choosenmutate = RandomizedEvent.new(AllEvents[self.ChoosenOne])

print(self.ChoosenOne)
EventCall.CallEvent("MessageEvent", "The King Of "..self.ChoosenOne.." Has Choosen To Mutate The Tower From "..self.choosenmutate, Color3.fromRGB(85, 170, 255),"rbxassetid://5893607560")
EventCall.CallEvent("NotificationEvent", "The King Of "..self.ChoosenOne.." Has Choosen To Mutate The Tower From "..self.choosenmutate, 2)

wait(1.5)

for i = 4, 1, -1 do
	EventCall.CallEvent("MessageEvent", "Mutating The Tower From "..self.choosenmutate.." In "..i, Color3.fromRGB(255, 85, 0), "rbxassetid://6761979152")
	wait(1)
end

end

return HeavenAndHell

script 5:
local RandomEvent = {}

function RandomEvent.new(events)
local self = setmetatable({}, RandomEvent)

local event = events[math.random(1,#events)]



return event	

end

return RandomEvent

I know it’s a lot of code, sorry.

Could you format your code properly please?

2 Likes

How do i do that, I’m new to the dev forum?

Put 3 ```s at the start and end of the code.

print('hello!')

Click here for more information.