Roblox map voting: let players pick the next map
Short answer
During intermission, pick 3 random maps from ServerStorage, publish them to clients, accept one vote per player through a RemoteEvent (a new vote replaces the old one), and when the timer ends, count votes, break ties at random and clone the winning map into workspace.
Copy-paste code
Server: one vote round
local maps = game.ServerStorage.Maps:GetChildren()
local Vote = game.ReplicatedStorage.MapVote -- RemoteEvent
local rng = Random.new()
local function runVote(seconds)
local pool = table.clone(maps)
local options = {}
for i = 1, math.min(3, #pool) do
table.insert(options, table.remove(pool, rng:NextInteger(1, #pool)).Name)
end
local votes = {} -- [player] = map name
local conn = Vote.OnServerEvent:Connect(function(player, choice)
if table.find(options, choice) then votes[player] = choice end
end)
Vote:FireAllClients(options, seconds)
task.wait(seconds)
conn:Disconnect()
local count = {}
for _, name in options do count[name] = 0 end
for player, name in votes do if player.Parent then count[name] += 1 end end
local best, winners = -1, {}
for _, name in options do
if count[name] > best then best, winners = count[name], { name }
elseif count[name] == best then table.insert(winners, name) end
end
local chosen = winners[rng:NextInteger(1, #winners)]
local map = game.ServerStorage.Maps[chosen]:Clone()
map.Parent = workspace
return map
endGood to know
Destroy the previous map before cloning the next one, or rounds will stack maps.
Only count votes from players still in the server (player.Parent).
Roundmoor Round & Match System: Rounds, map votes and teams that never get stuck
from $7Roundmoor includes the map and mode vote, fair teams, win checks for four modes and the full round loop, tested together.
Secure checkout · 14-day fix-or-refund if it doesn't work as described (terms)Questions
How do clients vote?
Show the 3 options from Vote.OnClientEvent as buttons; each button calls Vote:FireServer(name).
How do I stop the same map twice in a row?
Remove the last map's name from the pool before picking options.
Free: the Roblox Starter Kit
7 free Luau modules (damage, pets, shop formatting, admin audit log, tycoon guards and more) plus 3 free calculators, then 5 short emails with the scripting fixes we see go wrong most often.