What do you want to achieve? Keep it simple and clear!
I need all children in a folder (they are models) move
What is the issue? Include screenshots / videos if possible!
The console says invalid argument #1 (CFrame expected, got table)
for name, child in pairs(prevRoom.Furniture:GetChildren()) do -- Looping through all of the children
if child.Name == "LightsWhite" then
else
if child.Name == "LightsRed" then else
for i = 1,10 do
child:SetPrimaryPartCFrame(CFrame * CFrame.new(0, 0.25, 0))
wait(0)
end
end
end
end
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
You’re trying to index a datatype constructor the incorrect way, also SetPrimaryPartCFrame is now deprecated and should be replaced with PivotTo instead
I would also confirm that the “Models” are actually models so that your code doesn’t accidentally error in case you insert something else, like a BasePart which has different properties
for name, child in pairs(prevRoom.Furniture:GetChildren()) do -- Looping through all of the children
if child:IsA("Model") then
if child.Name == "LightsWhite" then
print("Found Lights White")
elseif child.Name == "LightsRed" then
print("Found Lights Red")
else
print("Moving Part")
for i = 1,10 do
child:PivotTo(child.PrimaryPart.CFrame * CFrame.new(0, 0.25, 0))
task.wait()
end
end
end
end
Keep in mind that you’ll have to reference a PrimaryPart for the model, so that it’s able to be properly moved otherwise it’ll throw back an error