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

What's the best way to rotate a part?

Recently i've been trying to make synchronized movements with parts. I used CFrame to move the brick, but i don't know how to rotate the block. I need a way to spin the brick with a determined amount of time.

2 comments

0

Use CFrame.Angles and tween/lerp it

0

How?

1 answer

✓ Accepted answer

If your goal is to spin the brick for a certain amount of time we can use BodyAngularVelocity

let's create a function that will create this instance, place it inside the brick and disappear after an amount of time

local brick=workspace.Part

function spin()
	local b=Instance.new("BodyAngularVelocity")
	b.MaxTorque=Vector3.new(0,40000,0) --will only affect the Y axis
	b.AngularVelocity=Vector3.new(0,100,0) --will spin on the Y axis
	b.P=5000 -- PLAY AROUND WITH P (POWER)
	b.Parent=brick
	--using debris to make brick stop spinning after 10 seconds
	game:GetService("Debris"):AddItem(b,10)
end

spin()

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