I have this script, right? Basically finds everything inside a folder and rotates it into the right direction. And this error keeps popping up even when I think it’s all correct. Here’s the script.
for i,npc in pairs(game.Workspace.ViewportFrames:GetDescendants()) do
if npc:IsA("Model") then
print(npc.Name)
npc:GetPivot().Rotation = Vector3.new(0,180,0)
end
end
:GetPivot() returns a CFrame, which has a Position and Rotation value. Position is a Vector3, and Rotation is a CFrame without a position. To set the rotation, use:
local c = npc:GetPivot()
npc:SetPivot(CFrame.new(c.Position) * CFrame.Angles(0,math.rad(180),0))
This creates a new cframe with no rotation, and then rotates it 180 degrees on the Y axis. It sets the npc’s pivot to that.