How to rotate part vertically

This video shows want I want to achieve


In the video I only go half way but I want it to be able to turn all the way around and how many times I want

You want to do that in a script?

yes and use clickdetector or just clicking it with my mouse

use a click detector and change the orientation to something for every click

something like


click.MouseButton1:Connect(function(parameter) --i forgot how click detectors work
   part.Orientation = part.Orientation + vector3.new(10,0,0)
end

change the vector3 to your liking

but i change the orientation its really hard cause when i change the rotation sometimes i need to change the Y and Z value for the orientation

2 Likes

Just get the part.orientation.z and y

simple enough server script inside the part u want to rotate

local runservice = game:GetService("RunService")
local increment = 5
runservice.Heartbeat:Connect(function(DT)
	script.Parent.CFrame *= CFrame.fromEulerAnglesXYZ(math.rad(increment + DT), 0,0)
end)

When I do it, it doesn’t rotate all the way around

Send script + video. the code works fine for me

The script is basically just the clickdetector mouse click and then the part’s orientation (+25,0,0)

What happens is that it goes half way then it goes back 1 and forward 1