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

How do I change only the Y value of a part's orientation?

I have been trying to make so that only the Y value of a part's orientation would change, can someone please help me out?

1 answer

Hello Zeppelin0330,

I got my answer from this page: https://developer.roblox.com/en-us/api-reference/property/BasePart/Orientation

local part = script.Parent
 
local incr = 360/20
 
-- Rotate the part continually
while true do
	for deg = 0, 360, incr do
		-- Set only the Y axis rotation
		part.Rotation = Vector3.new(0, deg, 0)
		-- A better way to do this would be setting CFrame
		--part.CFrame = CFrame.new(part.Position) * CFrame.Angles(0, math.rad(deg), 0)
		wait()
	end
end

Hope I helped!

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