House Generating on a Baseplate

So i’m trying to make a baseplate with the Roblox classic house cloning infinitely across the baseplate.

Problem is I have no clue what i am doing and i have gotten to this:

--forever generation

local original = game.ReplicatedStorage["Classic House"]

local int = 5




while true do
	
	
	
	local value = int + 5
	
	local number = CFrame.new(value,value,value)
	
	local copy = original:Clone()
	
	copy.Parent = game.Workspace
	
	copy:PivotTo(number)
	
	
	
	wait()
	
end

I’m more of a c++ guy so i was planning on doing a simple var++ but that’s not (to my understanding) in lua.
How can i go about making this work?

First issue I see is:

while true do
    [...]
    wait()
end

This will hang the thread forever until the script time exhausts. Try giving this a limit, or at least an amount of time to wait between iterations.
Something like:

local original = game:GetService("ReplicatedStorage"):WaitForChild("Classic House")

local int = 5

while true do
	local clone = original:Clone()
	clone.Parent = workspace
	clone:SetPrimaryPartCFrame(CFrame.new(int, int, int))
	
	int += 5
	task.wait(1)
end

This will wait a second before making a new clone at (5,5,5), (10,10,10), … which might not be the end result you’re after, since it will create a line through the sky and not a grid of houses like I think you might be after.

1 Like

I was more focused on actually duplicating the houses rather than where they would go, but otherwise thank you very much.