Hi forum! I’ve been working on a racing game where I want maps selected every round. I have created maps in the replicated storage with configuration values that contain the difficulty of the map and the title (which i want to display on a gui.) While I was working through this system I got a bit confused on how to make the map selection work (where 3 different maps get selected to have people vote on, I got the selection working its just the maps can be the same sometimes and I’m unsure how to work around this. I’m aware of tables but I got a bit confused)
local rs = game:GetService("ReplicatedStorage")
local remoteEventsFolder = rs.RemoteEvents
local votingEvent = remoteEventsFolder.Voting
local randomMap1 = rs.Maps:GetChildren()[math.random(1, #rs.Maps:GetChildren())]
local randomMap2 = rs.Maps:GetChildren()[math.random(1, #rs.Maps:GetChildren())]
if randomMap2 == randomMap1 then
randomMap2 = rs.Maps:GetChildren()[math.random(1, #rs.Maps:GetChildren())]
return
end
local randomMap3 = rs.Maps:GetChildren()[math.random(1, #rs.Maps:GetChildren())]
if randomMap3 == randomMap1 or randomMap3 == randomMap2 then
randomMap3 = rs.Maps:GetChildren()[math.random(1, #rs.Maps:GetChildren())]
return
end
print(randomMap1,randomMap2,randomMap3)
votingEvent:FireAllClients(randomMap1, randomMap2, randomMap3)