This video shows me testing out the rotation feature of my build system. Here is the code:
uis.InputBegan:Connect(function(input, process)
if selected ~= false and previewpart ~= nil then -- if there is a build selected and a preview part, then
if input.KeyCode == Enum.KeyCode.R then -- tells script to rotate along x axis
if uis:IsKeyDown(Enum.KeyCode.LeftShift) then -- if shift is held down, rotate the part in the opposite direction
previewpart.Orientation += Vector3.new(15, 0, 0)
else
previewpart.Orientation -= Vector3.new(15, 0, 0)
end
elseif input.KeyCode == Enum.KeyCode.T then -- tells script to rotate along y axis
if uis:IsKeyDown(Enum.KeyCode.LeftShift) then
previewpart.Orientation += Vector3.new(0, 15, 0)
else
previewpart.Orientation -= Vector3.new(0, 15, 0)
end
elseif input.KeyCode == Enum.KeyCode.Y then -- tells script to rotate along the Z axis
if uis:IsKeyDown(Enum.KeyCode.LeftShift) then
previewpart.Orientation += Vector3.new(0, 0, 15)
else
previewpart.Orientation -= Vector3.new(0, 0, 15)
end
end
end
end)
I’m running into an issue with the orientation property. The selected part in the video is the white preview part shown on my mouse, you can see its’ orientation property in the properties window.
While rotating the part, I noticed the orientation property ranges from -180 to 180 instead of 0 to 360 degrees. This causes some weird glitches with the rotation, as seen in the end of the video (I was only pressing R at the end of the video)