I have a script that randomly generates a set path etc but the obstacle gen function doesn't output the name it just outputs nil but the base gen function works fine (they're both basically the same)
Explorer: https://imgur.com/a/1qWea8K
Code (I know its messy and bad I'm very new to scripting in roblox):
local worldFolder = game.Workspace.ZaWarudo
local modelsFolder = game.ReplicatedStorage:WaitForChild("Models")
local randomModel
local randomName
for _, child in ipairs(worldFolder.Placements:GetChildren()) do
child.Transparency = 1 --Sets the things transparency to 1 so that it wont show in play mode but only in editor
end
local function checkBases()
for _, child in ipairs(worldFolder.Placements:GetChildren()) do
if child.Name == "BigBasePlacement" then
local models = modelsFolder:WaitForChild("Platforms"):WaitForChild("BigBase"):GetChildren()
n = math.random(1, #models)
randomModel = models[n]
randomName = randomModel.Name
theCFrame = child.CFrame
print(randomModel.Name)
else if child.Name == "MediumBasePlacement" then
local models = modelsFolder:WaitForChild("Platforms"):WaitForChild("MediumBase"):GetChildren()
n = math.random(1, #models) --select a random obstacle / base
randomModel = models[n]
randomName = randomModel.Name
theCFrame = child.CFrame
print(randomModel.Name)
else if child.Name == "CheckpointPlacement" then
local models = modelsFolder:WaitForChild("Platforms"):WaitForChild("Checkpoint"):GetChildren()
n = math.random(1, #models)
randomModel = models[n]
randomName = randomModel.Name
theCFrame = child.CFrame
print(randomModel.Name)
end
end
end
--wait(0.5)
print(randomName)
local newGroup = Instance.new("Model")
newGroup.Parent = worldFolder.Models
--newGroup.Name = randomName
--randomModel.Parent = newGroup
--local veryNew = newGroup:Clone()
--local yeet = randomModel.Name
--veryNew.yeet.Parent = worldFolder.Models
--veryNew.yeet.CFrame = theCFrame
end
end
local function checkObstacles()
for _, child in ipairs(worldFolder.Placements:GetChildren()) do
if child.Name == "ObstacleBase1x1Placement" then
local models = modelsFolder:WaitForChild("Obstacles"):WaitForChild("Obstacle1x1"):GetChildren()
n = math.random(1, #models) --select a random obstacle / base
randomModel = models[n]
randomName = randomModel.Name
theCFrame = child.CFrame
print(randomModel.Name)
else if child.Name == "ObstacleBase2x1Placement" then
local models = modelsFolder:WaitForChild("Obstacles"):WaitForChild("Obstacle2x1"):GetChildren()
n = math.random(1, #models)
randomModel = models[n]
randomName = randomModel.Name
theCFrame = child.CFrame
print(randomModel.Name)
else if child.Name == "ObstacleBase3x2Placement" then
local models = modelsFolder:WaitForChild("Obstacles"):WaitForChild("Obstacle3x2"):GetChildren()
n = math.random(1, #models)
randomModel = models[n]
randomName = randomModel.Name
theCFrame = child.CFrame
print(randomModel.Name)
end
end
end
--wait(0.5)
print(randomName)
local newGroup = Instance.new("Model")
newGroup.Parent = worldFolder.Models
--newGroup.Name = randomName
--randomModel.Parent = newGroup
--local veryNew = newGroup:Clone()
--local yeet = randomModel.Name
--veryNew.yeet.Parent = worldFolder.Models
--veryNew.yeet.CFrame = theCFrame
end
end
while true do
wait(1)
checkObstacles()
wait(1)
checkBases()
wait(120)
worldFolder.Models:ClearAllChildren()
wait(5)
end

3 comments
The checkObstacles() works fine but the checkBases doesnt work since it doesnt make the randomName into the randomModel.Name for whatever reason
wait i mixed em up lol its the checkBases that works not checkObstacles
Ok turns out that in checkObstacles() i cant call any things such as .Name or do :Clone() oor .Parent etc