I’m trying to clone parts this is the game 4 parts one doesnt kill you and if you step on one of the next line of the row will also not kill you in the script im trying to get them on the right position with the right color partren cause they have a patren but it doesn’t work for some reason row 4 gets deleted instead of copied or the name of 4 turns into 5, but for sure it doesnt work the problem is somewhere in the repeat thing and it run a few times like 2 but after that it stops for some reson it doesnt go furter then te repeat thing here is the script and the workspace can someone please help me!?! I also have no idea where the problem is cause it just runs but not how I want it to Please don’t reply if you can’t help me!
heres the workspace
and heres part of the script:
local playerAmount = #game:GetService("Players"):GetPlayers()
local calculationRowsAmount = playerAmount / 1.7
local calculatingRowsAmount = playerAmount * 2
local calculatorRowsAmount = calculatingRowsAmount - calculationRowsAmount
local finalRowsAmount = math.ceil(calculatorRowsAmount)
local amountRows = #platesFolder:GetChildren()
repeat
local newAmountRows = #platesFolder:GetChildren()
local rowToClone = platesFolder:FindFirstChild("Row"..tostring(newAmountRows))
local rowClone = rowToClone:Clone()
rowToClone.Name = "Row"..newAmountRows + 1
rowToClone.Parent = platesFolder
print("Aplied Settings")
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
wait(0.5)
until #platesFolder:GetChildren() == finalRowsAmount