Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Help With Rotating Parts In a Model?

rotation=true
			parts = game.Workspace.MailOffice.Customer1:GetChildren()
			for i=1,#parts do
				if parts[i]:IsA("Part") then
					parts[i].CFrame=parts[i].CFrame+Vector3.new(0,0,0)
					if rotation==true then parts[i].CFrame=CFrame.fromEulerAnglesXYZ(0,180,0) * parts[i].CFrame
					else
					end
				end
			end

So basically, I just want everything in this model to turn 180 degrees (when it's copied in from ReplicatedStorage, it's backwards). However, rather than just turning around, it does a complete spin around the map and ends up somewhere completely random. Any help with this?

1 answer

✓ Accepted answer

so you want to set a primary part to the model, this position and rotation will be based around this,

Then you want to set the position by using the following

game.Workspace.MailOffice.Customer1:SetPrimaryPartCFrame()

When you have that done, make sure the model is anchored. You can set the position, and rotation by doing the following

game.Workspace.MailOffice.Customer1:SetPrimaryPartCFrame(CFrame.new(0,0,0) * CFrame.fromEulerAnglesXYZ(0,180,0))

You can read up on the model's and their PrimaryPartCFrame here: Link

Note: You were rotating every single part apon their own axis, instead of the models.

1 comment

0

This was my idea. I approve.

This discussion is preserved as it was. New answers, comments, and votes are closed.