Model can't be rotated, 0 errors show up, glitch?

I’m trying to rotate a model 90 degrees by doing the following:

print("Working")
Object:SetPrimaryPartCFrame(Object:GetPrimaryPartCFrame()*CFrame.Angles(0,math.rad(90),0))

Working gets printed.
However, this doesn’t do anything. Doesn’t return any errors, nothing, am i writing it wrong?

Some Additional info:

  • Yes, the code runs the full way through, a print after the second line gets printed
  • This is triggered by an inputended function, but this shouldn’t be relevant to this.

It doesn’t look like there’s anything wrong with this specific line, so this might be a problem with some other area of your code (maybe this line is never being reached and not running?). It would throw an error if the Model object didn’t have a primary part, or anything obvious like that.

I’ve debugged it with a print before and after setting the model CFrame, it still hasn’t done anything so it does reach the line which is weird…

Is the object’s CFrame being set anywhere else in the script?

No it’s not, In the same script, the walls cframe gets updated on userinputchanged, I’ve tried to rule this out and it still didn’t work.

Is the wall you referred to as ‘Object’ actually referred to properly by the script?
Is the wall Anchored? If it’s Unanchored and attached to something else this CFrame script won’t move it.

1 Like

It’s referred to properly and it’s anchored, it just doesnt seem to work in this scenario:

elseif Input.KeyCode == Enum.KeyCode.R then
		if Placing == true then
			Object:SetPrimaryPartCFrame(Object:GetPrimaryPartCFrame()*CFrame.Angles(0,math.rad(90),0))
		end

But works fine in this:

function Place:Update(hit, Target)
	if Placing == true then
		local Level = Grid.Position.Y + (Grid.Size.Y / 2) + (Object.PrimaryPart.Size.Y / 2)
		local DistFromTL = TopLeft - Vector3.new(Round(hit.p.X), Level, Round(hit.p.Z))
		
		game.Workspace.Placing:FindFirstChildWhichIsA("Model"):SetPrimaryPartCFrame(CFrame.new((TopLeft.X - DistFromTL.X) + ObjectExtents.X / 2, Level, (TopLeft.Z - DistFromTL.Z) + ObjectExtents.Z / 2))
		Intersect()
	end
end

Omg i’m so stupid, i forgot that object gets cloned… omg, sorry!

In the first example you refer to it as: Object:SetPrimaryPartCFrame(Object:GetPrimaryPartCFrame()*CFrame.Angles(0,math.rad(90),0))
but in the second case you refer to it as:
game.Workspace.Placing:FindFirstChildWhichIsA(“Model”):SetPrimaryPartCFrame(CFrame.new((TopLeft.X - DistFromTL.X) + ObjectExtents.X / 2, Level, (TopLeft.Z - DistFromTL.Z) + ObjectExtents.Z / 2))

2 Likes