Map Generator Like Build A Boat

I’m making a game like build a boat and the map generation is bugged and giving me errors.

image

local OceanGenerator = {}

function OceanGenerator.Generate(mapNumber, nextMapNumber)
	local mapFind = script.Maps:FindFirstChild(mapNumber)
	local nextMap = script.Maps:FindFirstChild(nextMapNumber)
	if mapFind and nextMap then
		nextMap.Hitbox.Front.Position = mapFind.Hitbox.End.Position

		mapFind:Clone().Parent = workspace.Maps
		nextMap:Clone().Parent = workspace.Maps

	end
end

return OceanGenerator

Script

local OceanGenerator = require(game.ServerStorage.OceanGenerator)
local RunService = game:GetService("RunService")

local MAX = 5 -- Needs To Be 1 More Then How Many Levels There Are
local LoadedAreasNEXT = 2
local LoadedAreas = 1

local MapTable = {
	[1] = "One",
	[2] = "Two",
	[3] = "Three",
	[4] = "Four",
}

function Gen()
	if LoadedAreas == MAX then
		return
	else
		OceanGenerator.Generate(MapTable[LoadedAreas], MapTable[LoadedAreasNEXT])
		LoadedAreas += 1
		LoadedAreasNEXT += 1
	end
end

repeat 
	Gen()
until LoadedAreas == MAX

That error means it couldnt find anything with the name “Front” inside of Map.Three.Hitbox, make sure theres something called “Front” inside of it and that its spelled correctly.

1 Like

Thanks i thought i put them all in the hitboxes welp I didn’t :frowning: