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

How do I rotate an Instance.new Part?

I have this Instance.new part and I changed most of it's properties except I'm not exactly sure how I would rotate it.

local Blast = Instance.new("Part")
Blast.Name = "Blast"
Blast.Shape = Enum.PartType.Block
Blast.Size = Vector3.new(9.38, 0.29, 0.26)
Blast.Material = Enum.Material.Neon
Blast.BrickColor = BrickColor.new("Toothpaste")
Blast.CanCollide = false
Blast.Parent = game.Workspace
Blast.Transparency = 0
Blast.Orientation = Vector3.new(0,0,90) --What I'm having trouble with
Blast.CFrame =     Character.HumanoidRootPart.CFrame*CFrame.new(0,0,0)

2 comments

0

You have to be a little more specific. How do you want to rotate it? Upside down? Point towards another part? etc.

0

You can multiply the part’s CFrame. Part.CFrame = Part.CFrame * CFrame.Angles(0,0,math.rad(90)).

1 answer

✓ Accepted answer

You would use CFrame.Angles(). Here are the following dimensions and how the part would spin (assuming the part is parallel to the Baseplate):

  1. X - The part spins parallel to the Baseplate on its center. (It spins as if it were on a Motor.)
  2. Y - The part spins perpendicular to the Baseplate with a spin from negative to positive Y (unless a negative number is given).
  3. Z - The part spins perpendicular to the Baseplate with a spin from negative to positive Z (unless a negative number is given).

Here's an example of rotating a part:

local part = Instance.new("Part")
part.Parent = workspace
part.Position = workspace.Baseplate.Position + Vector3.new(0,10,20)
while true do
    wait(0.1)
    part.CFrame = part.CFrame * CFrame.Angles(0,0, math.rad(10))
end

CFrame.Angles() uses radians, so in order to rotate the part you would use math.rad().

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