I have a loop, that’s supposed to change the position of an object, which is does and it prints 3 different pivot points correctly. However, later on in the script, it prints the 3 same pivots
for _, floor in GeneratedTower do
floor:PivotTo(End.CFrame)
print(floor:GetPivot())
end
for _, floor in GeneratedTower do
print(floor:GetPivot())
end
The first there prints show that the pivots have changed, but the last print shows that all 3 are the same.
I do other things in the first loop that aren’t relevant to the question and the second for loop is just to show that the pivots aren’t actually changing for some reason
Since all three were assigned to the same pivot, I would think they should all print to be the same in the first loop. I suspect what is actually going on here, is that GetPivot is returning you a cached/out-of-date value from before the pivot was moved. You could test this theory by printing in the line before you change the pivot, and seeing if the value remains unchanged.
The first loop has more code to it, where End changes each loop, So the first loops prints are correct. It’s the second loop that’s printing incorrect values. Even though I change each floors pivot in the first loop, they just get reset back after for o apparent reason
Alright. Then if you want me to help debug your code, I’ll need to see all of it. I don’t think the bug is in the parts of the code you’ve shown so far.