Hi,
I have a map voting system in place but I’m having trouble with loading the associating map that’s voted, and I have no idea how to move forward. I initially used AlvinBlox’s tutorial as inspiration, but his code uses randomness for selecting maps. My one, however, is decided through votes by players via the touch event, or the game picks randomly (in the case of a tie).
That said, I want my script to draw a map model (child) - with its correlating MapName - from the “Maps” folder in replicated storage, is cloned, retains its map name for multi-round use, and is then parented to the workspace. I’m aware that I need to destroy this model for it to be returned to replicated storage to flow with a round-based system; I just need help with having it in the workspace in the first place. This is as transparent as I can be because I really have no idea what I’m doing LOL.
-- ...
local HighestVoted
for i, Pad in pairs(Pads:GetChildren()) do
if not HighestVoted then HighestVoted = Pad end
if #Pad.Votes:GetChildren() > #HighestVoted.Votes:GetChildren() then
HighestVoted = Pad
elseif #Pad.Votes:GetChildren() == #HighestVoted.Votes:GetChildren() then
local MapsToChoose = {Pad, HighestVoted}
HighestVoted = MapsToChoose[math.random(#MapsToChoose)]
end
end
local MapName = MapBoards["Map".. string.gsub(HighestVoted.Name, "MapVote", "")].MapGUI.MapName.Text
local Maps = game.ReplicatedStorage.Maps:GetChildren()
local ChosenMap = -- MapName variable here, etc. (Help here... after players voted for a particular MapName, the associated map model with the same name is selected from the Maps folder)
local ClonedMap = ChosenMap:Clone()
ClonedMap.Name = -- (Help here... example of a map name: "Haunted Mansion")
ClonedMap.Parent = game.Workspace
-- ...
Any input is appreciated.