for some reason this script got the error “Script timeout: exhausted allowed execution time”
this is the script:
repeat
local newAmountRows = #platesFolder:GetChildren()
local rowToClone = platesFolder:FindFirstChild("Row"..tostring(newAmountRows))
local rowClone = rowToClone:Clone()
rowToClone.Parent = platesFolder
for i,v in pairs(rowClone:GetChildren()) do
if v.Name == "Row" then
v.Value += 1
elseif v.Name == "Plate" then
local currentPlate = v
local currentLine = v.Line.Value
local thisRow = v.Parent.Row.Value
local colorRowToSearch = thisRow - 2
local otherColorModel = platesFolder:FindFirstChild("Row"..tostring(colorRowToSearch))
local positionRowToSearch = thisRow - 1
local otherPositionModel = platesFolder:FindFirstChild("Row"..tostring(positionRowToSearch))
for i,v in pairs(otherPositionModel:GetChildren()) do
if v.Name == "Plate" then
for i,v in pairs(v:GetChildren()) do
if v.Name == "Line" then
if v.Value == currentLine then
local otherPositionPart = v.Parent
local newPositionX = otherPositionPart.Position.X + 9
local newPositionY = otherPositionPart.Position.Y
local newPositionZ = otherPositionPart.Position.Z
currentPlate.CFrame = CFrame.new(newPositionX, newPositionY, newPositionZ)
end
end
end
end
end
for i,v in pairs(v:GetChildren()) do
if v.Name == "Line" then
for i,v in pairs(otherColorModel:GetChildren()) do
if v.Name == "Plate" then
for i,v in pairs(v:GetChildren()) do
if v.Name == "Line" then
if v.Value == currentLine then
local otherColorPart = v.Parent
currentPlate.Color = otherColorPart.Color
end
end
end
end
end
end
end
end
end
until #platesFolder:GetChildren() == finalRowsAmount