trying to make this model rotate here is the script It is a local script and is apart of a building script but it is not rotating
local function RotateObject(Key, Processed)
if not Processed and NewObject and NewObject.PrimaryPart then
if Key.KeyCode == Enum.KeyCode.R then
-- Rotate clockwise
Rotation = Rotation + RotationAmount
NewObject:SetPrimaryPartCFrame(NewObject.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(RotationAmount), 0))
print("Rotated clockwise: New angle " .. Rotation)
elseif Key.KeyCode == Enum.KeyCode.T then
-- Rotate counterclockwise
Rotation = Rotation - RotationAmount
NewObject:SetPrimaryPartCFrame(NewObject.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(-RotationAmount), 0))
print("Rotated counterclockwise: New angle " .. Rotation)
end
end
end
and it prints everything but no errors need help
also have tried using PivotTo()