Issues scripting map specific hardpoint for fps gamemode

Hello, I am trying to make a hardpoint gamemode for my fps game. But I am having trouble scripting map specific hardpoints, as well as making them randomized per each map without having each map in my workspace. I would appreciate any recommendations as for how to fix this or even a different way at approaching it!
Here is my code:

> local RunService = game:GetService("RunService")
> 
> local trainyardhardpointFolder = workspace:WaitForChild("TrainYardHardpoints")
> local apocalypsehardpointFolder = workspace:WaitForChild("ApocalypseHardpoints")
> local BusinessCenterhardpointFolder = workspace:WaitForChild("BusinessCenterHardpoints")
> local DeserthardpointFolder = workspace:WaitForChild("DesertHardpoints")
> local eventFolder = game.ReplicatedStorage:WaitForChild("HardPoint_Events")
> local activePoint = nil
> local timeRemaining = 0
> local queueIndex = 1;
> local queueNum = 1
> local gameActive = game.ReplicatedStorage:WaitForChild("GameActive").Value;
> gameActive = false
> local curOwner = nil
> local curCap = nil
> local touchedCapEvent = nil
> local maps = game.ReplicatedStorage:WaitForChild("Maps"):GetChildren()
> local gameMapFolder = game.Workspace:WaitForChild("gameMap"):GetChildren()
> 
> 
> 
> --// Modules
> local config = require(script.Config)
> 
> --// Events
> local hardEvent = eventFolder.HardEvent
> local sendDataEvent = eventFolder.SendData
> local gameOverEvent = eventFolder:WaitForChild("GameOver")
> local pointMoved = eventFolder:WaitForChild("PointMoved")
> 
> --// Tables
> local queue = {}
> 
> local teamScore = {
> 	homeTeam = 0;
> 	awayTeam = 0;	
> }
> 
> 
>  local function loadMap()
> 	local activeMap = math.random(1, #maps)
> 	 mappicked = maps[activeMap]:Clone()
> 	mappicked.Parent = game.Workspace
> end
> 
> local function removeMap()
> 	mappicked:Destroy()
> end
> 
> --// Functions
> local function activatePoint(point)
> 	if activePoint then
> 		--local randpoint = gameMapFolder.Points:GetChildren()
> 		activePoint.Trigger.Transparency = 1
> 		activePoint.Trigger.BrickColor = BrickColor.new("White")
> 		activePoint.Display.BillboardGui.Title.BackgroundColor3 = BrickColor.new("White").Color
> 		activePoint.Display.BillboardGui.Enabled = false
> 
> 		curOwner = nil
> 	end;
> 	
> 	if touchedCapEvent then
> 		touchedCapEvent:Disconnect()
> 	end
> 	
> 	curOwner = nil
> 	activePoint = point
> 	activePoint:WaitForChild("Trigger").Transparency = 0
> 	activePoint.Display.BillboardGui.Enabled = true
> 	timeRemaining = config.PointTime
> 	curOwner = nil
> 	curCap = point
> 	
> 	local debounce = true
> 	touchedCapEvent = activePoint.Trigger.Touched:Connect(function(what)
> 		if what and game.Players:FindFirstChild(what.Parent.Name) and debounce then
> 			local player = game.Players[what.Parent.Name]
> 			local humanoid = player.Character:FindFirstChild("Humanoid")
> 			if humanoid then
> 				if config.DeathCap or humanoid.Health > 0 then
> 					debounce = false
> 					curOwner = player.Team
> 					activePoint:WaitForChild("Trigger").BrickColor = curOwner.TeamColor
> 					activePoint.Display.BillboardGui.Title.BackgroundColor3 = player.TeamColor.Color
> 					task.wait(0.5)
> 					debounce = true
> 				end
> 			end
> 		end
> 	end)
> end
> 
> 
> local function SelectPoint()
> 	task.wait()
> end
> 
> 
> local function EndGame(winner)
> 	gameOverEvent:FireAllClients(winner,config.HomeTeam.Name,config.AwayTeam.Name,teamScore.homeTeam,teamScore.awayTeam)
> 	gameActive = false
> 	timeRemaining = 0
> 	removeMap()
> end
> 
> -- https://developer.roblox.com/en-us/api-reference/property/DataModel/PrivateServerId
> local function getServerType()
> 	if game.PrivateServerId ~= "" then
> 		if game.PrivateServerOwnerId ~= 0 then
> 			return "VIPServer"
> 		else
> 			return "ReservedServer"
> 		end
> 	else
> 		return "StandardServer"
> 	end
> end
> 
> local function hasPermission(player)
> 	print("Checking permission...")
> 	-- Generally for normal raids
> 	if player:IsInGroup(config.GroupID) and player:GetRankInGroup(config.GroupID) >= config.RankNum then
> 		print(player.Name .. " has the adequate rank in configured group.")
> 		return true
> 	end
> 	
> 	-- For testing purposes in studio
> 	if RunService:IsStudio() then
> 		print("In Studio")
> 		return true
> 	end
> 	
> 	-- Private server support, owners of private servers should be able to start a raid
> 	if getServerType() == "VIPServer" and game.PrivateServerOwnerId == player.UserId then
> 		print(player.Name .. " is the private server owner.")
> 		return true
> 	end
> 	
> 	return false
> end
> 
> --// Player Connections
> gameActive = true
> SelectPoint()
> 
> --// Event Connection
> hardEvent.OnServerEvent:Connect(function(player)
> 	player:LoadCharacter()
> 	loadMap()
> 	sendDataEvent:FireClient(player, teamScore.homeTeam, teamScore.awayTeam, config.MaxPoints, config.HomeTeam, config.AwayTeam)
> end)
> 
> --// Renders
> task.spawn(function()
> 		while true do
> 			
> 		if gameActive then
> 			 
> 			 -- gets all the players
> 			-- forces the respawn
> 			-- Win condition
> 			if teamScore.homeTeam == config.MaxPoints or teamScore.awayTeam == config.MaxPoints then
> 				if teamScore.homeTeam == config.MaxPoints then
> 					mappicked:Destroy()
> 					EndGame(config.HomeTeam)
> 				elseif teamScore.awayTeam == config.MaxPoints then
> 					mappicked:Destroy()
> 					EndGame(config.AwayTeam)
> 				end
> 			end
> 		
> 		-- Time to move to another point
> 			if gameActive and timeRemaining == 0 then
> 				pointMoved:FireAllClients()
> 				if config.Mode == "RANDOM" then
> 					
> 					-- Move to points at random
> 					local list = {}
> 					task.wait()
> 					if mappicked == "TrainYard" then
> 						for _, v in ipairs(trainyardhardpointFolder:GetChildren()) do
> 							if v and v ~= curCap then -- Not counting the current cap we're on
> 								table.insert(list,v)
> 							end
> 						end
> 						local index = math.random(1, #list)
> 						activatePoint(list[index])
> 					end
> 					
> 					if mappicked == "Desert" then
> 						for _, v in ipairs(DeserthardpointFolder:GetChildren()) do
> 							if v and v ~= curCap then -- Not counting the current cap we're on
> 								table.insert(list,v)
> 							end
> 						end
> 						local index = math.random(1, #list)
> 						activatePoint(list[index])
> 					end
> 					
> 					if mappicked == "Apocalypse" then
> 						for _, v in ipairs(apocalypsehardpointFolder:GetChildren()) do
> 							if v and v ~= curCap then -- Not counting the current cap we're on
> 								table.insert(list,v)
> 							end
> 						end
> 						local index = math.random(1, #list)
> 						activatePoint(list[index])
> 				end
> 				
> 					if mappicked == "BusinessCenter" then
> 						for _, v in ipairs(BusinessCenterhardpointFolder:GetChildren()) do
> 							if v and v ~= curCap then -- Not counting the current cap we're on
> 								table.insert(list,v)
> 							end
> 						end
> 						local index = math.random(1, #list)
> 						activatePoint(list[index])
> 					end
> 
> 					
> 				end
> 			end
> 		end
> 
> 		
> 		task.wait(1)
> 		
> 		if gameActive then
> 			if curOwner then
> 				if curOwner == config.HomeTeam then
> 					teamScore.homeTeam = teamScore.homeTeam + 1
> 				elseif curOwner == config.AwayTeam then
> 					teamScore.awayTeam = teamScore.awayTeam + 1
> 				end
> 				
> 				hardEvent:FireAllClients(curOwner, teamScore.homeTeam, teamScore.awayTeam, config.MaxPoints)
> 			end
> 			
> 			timeRemaining = timeRemaining - 1
> 		end
> 	end
> end)
1 Like