This is a round system script recently reworked, and I would like to know if this is the approach. have not finished the round(), but the other code works. I need to know if I use this number of events or if there is a better way to implement a round system.
I send the player ID to put the profile picture of the player into the map they voted for.
local players = game:GetService("Players")
local serverStor = game:GetService("ServerStorage")
local mapFolder = serverStor:FindFirstChild("Maps")
local replicated = game:GetService("ReplicatedStorage")
local RoundEvents = replicated:FindFirstChild("Round Sys Events")
local updateTime = RoundEvents:FindFirstChild("UpdateTimer")
local voteUpdate = RoundEvents:FindFirstChild("VoteUpdate")
local voteCast = RoundEvents:FindFirstChild("VoteCast")
local voteBegin = RoundEvents:FindFirstChild("VoteBegin")
local serverScript = game:GetService("ServerScriptService")
local RandomMapModule = require(serverScript:FindFirstChild("Voting Module"):FindFirstChild("Map Randomiser"))
local InterTime = 5
local votingTime = 5
local RoundTime = 120
local selectedMaps = {}
local mapNames = {}
local function Intermission()
selectedMaps = {}
mapNames = {}
for i = InterTime, 0 , -1 do
task.wait(1)
updateTime:FireAllClients(i)
end
end
local function Voting()
RandomMapModule:getMap(mapFolder, selectedMaps, mapNames) -- Gets 3 Random Maps From the folder
print(selectedMaps)
voteBegin:FireAllClients(selectedMaps, votingTime, mapNames)
for i = votingTime, 0, -1 do
task.wait(1)
updateTime:FireAllClients(i)
end
end
voteCast.OnServerEvent:Connect(function(player, value, ID)
voteUpdate:FireAllClients(ID, value)
end)
while true do
task.wait(1)
Intermission()
Voting()
end