Map voting system help

server-side

local chosen = {unpack(multimaps)}
		local m1 = chosen[math.random(1, #chosen)]
		table.remove(chosen, table.find(chosen, m1))
		local m2 = chosen[math.random(1, #chosen)]
		table.remove(chosen, table.find(chosen, m2))
		local m3 = chosen[math.random(1, #chosen)]
		table.remove(chosen, table.find(chosen, m3))
		mapvoting:FireAllClients(m1, m2, m3)

client-side

local player = game.Players.LocalPlayer
local mapvoting = game.ReplicatedStorage:WaitForChild("MapVoting")
local button = script:WaitForChild("Template")

mapvoting.OnClientEvent:Connect(function(m1, m2, m3)
	local m1button = button:Clone()
	wait()
	m1button.Parent = player.PlayerGui.GameUI.MapVoting.Main
	m1button.Text = m1.Name
end)

error

 Players.woloexe.PlayerScripts.MapVoting:9: attempt to index nil with 'Name'  -  Client - MapVoting:9
  14:07:39.070  Stack Begin  -  Studio
  14:07:39.071  Script 'Players.woloexe.PlayerScripts.MapVoting', Line 9  -  Studio - MapVoting:9
  14:07:39.071  Stack End  -  Studio

please help im confused on why its not working

1 Like

What is “multimaps”? Is it already an array of objects?

its a table of all the minigames in my game

Going to assume m<x> is a model. If the map model is located in a server-only container, the client will receive it as nil. Just pass over the name.

3 Likes

Put a print(m1, m2, m3).
What prints?

omg im so dumb yeah ur right tysm ill try that rn

it prints the maps names and stuff

Don’t call yourself dumb, we all make mistakes sometimes!

1 Like

i wasnt serious xdd i just meant it as i never thought of that