Help with rotating a model in a local script

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()

Is the Model welded to anything?

1 Like

No it is not well I don’t think atleast

There doesn’t look to be much wrong with your code, hence the question.
If a part or model is welded to an external object (one not part of the model), then it will be unable to rotate or change position using CFrame updates. The Weld C0 & C12 need to be updated to rotate attached parts/models.

I’ve been working on this for a whole day still no answer or figuring it out