hello, 4 months ago i made this game https://www.roblox.com/games/6997073541/infinite-rooms
and the code is
local gen = game.Workspace.generation
local ccc = script.cccccc
local istouched = false
function touched()
if not istouched == true then
istouched = true
if ccc.Value == true then
local cloen = script.Parent.Parent:FindFirstChild("room"..gen.Value):Clone()
gen.Value = gen.Value + 1
cloen.Parent = workspace
cloen.Name = "room"..gen.Value
script.Parent.Position = script.Parent.Position + Vector3.new(0,0,25)
for i,v in pairs(cloen:GetDescendants()) do
v.Position = v.Position + Vector3.new(0,0,25)
end
else
gen.Value = gen.Value + 1
local cloneroom = script.Parent.Parent.room:Clone()
cloneroom.Name = "room"..gen.Value
cloneroom.Parent = workspace
script.Parent.Position = script.Parent.Position + Vector3.new(0,0,25)
for i,v in pairs(cloneroom:GetDescendants()) do
v.Position = v.Position + Vector3.new(0,0,25)
end
ccc.Value = true
end
istouched = false
end
end
script.Parent.Touched:Connect(touched)
i feel like its sufficient, i want to improve it
any ideas?