Hi, I made a script, if the player clicks on a part, the part's orientation will get rotated with 15° degrees. But how do I repeat it? I mean when the Orientation reaches the Vector3.new(0,0,0) again, then the player can't rotate the part anymore.
local clickdetector = script.Parent.Parent.ClickDetector local part0 = script.Parent.Parent.Parent.Part0 clickdetector.MouseClick:Connect(function() if part0.Orientation == Vector3.new(0,0,0) then part0.Orientation = Vector3.new(0,0,-15) elseif part0.Orientation == Vector3.new(0,0,-15) then part0.Orientation = Vector3.new(0,0,-30) elseif part0.Orientation == Vector3.new(0,0,-30) then part0.Orientation = Vector3.new(0,0,-45) elseif part0.Orientation == Vector3.new(0,0,-45) then part0.Orientation = Vector3.new(0,0,-60) elseif part0.Orientation == Vector3.new(0,0,-60) then part0.Orientation = Vector3.new(0,0,-75) elseif part0.Orientation == Vector3.new(0,0,-75) then part0.Orientation = Vector3.new(0,0,-90) elseif part0.Orientation == Vector3.new(0,0,-90) then part0.Orientation = Vector3.new(0,0,-105) elseif part0.Orientation == Vector3.new(0,0,-105) then part0.Orientation = Vector3.new(0,0,-120) elseif part0.Orientation == Vector3.new(0,0,-120) then part0.Orientation = Vector3.new(0,0,-135) elseif part0.Orientation == Vector3.new(0,0,-135) then part0.Orientation = Vector3.new(0,0,-150) elseif part0.Orientation == Vector3.new(0,0,-150) then part0.Orientation = Vector3.new(0,0,-165) elseif part0.Orientation == Vector3.new(0,0,-165) then part0.Orientation = Vector3.new(0,0,180) elseif part0.Orientation == Vector3.new(0,0,180) then part0.Orientation = Vector3.new(0,0,165) elseif part0.Orientation == Vector3.new(0,0,165) then part0.Orientation = Vector3.new(0,0,150) elseif part0.Orientation == Vector3.new(0,0,150) then part0.Orientation = Vector3.new(0,0,135) elseif part0.Orientation == Vector3.new(0,0,135) then part0.Orientation = Vector3.new(0,0,120) elseif part0.Orientation == Vector3.new(0,0,120) then part0.Orientation = Vector3.new(0,0,105) elseif part0.Orientation == Vector3.new(0,0,105) then part0.Orientation = Vector3.new(0,0,90) elseif part0.Orientation == Vector3.new(0,0,90) then part0.Orientation = Vector3.new(0,0,75) elseif part0.Orientation == Vector3.new(0,0,75) then part0.Orientation = Vector3.new(0,0,60) elseif part0.Orientation == Vector3.new(0,0,60) then part0.Orientation = Vector3.new(0,0,45) elseif part0.Orientation == Vector3.new(0,0,45) then part0.Orientation = Vector3.new(0,0,30) elseif part0.Orientation == Vector3.new(0,0,30) then part0.Orientation = Vector3.new(0,0,15) elseif part0.Orientation == Vector3.new(0,0,15) then part0.Orientation = Vector3.new(0,0,0) end end)
Try this:
clickdetector.MouseClick:Connect(function() part0.Orientation = part0.Orientation + Vector3.new(0,15,0) end)