How would I make this turn sideways on its orientation too

I am creating Gizmo Arrows for my objects. However, when they rotate, they still move on the same plane. I want them to move the x direction of the Object, or like sideways.


It’s a simple script for testing.
Script:

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local dragging = false
local uis = game:GetService("UserInputService")
task.wait(1) --ignore this
local distance = (game.Workspace.movethis.Position - workspace.gizmoright.Position).Magnitude
mouse.Button1Down:Connect(function()
	if mouse.Target.Name == "gizmoright" or mouse.Target.Parent.Name == "gizmoright" and not dragging then
		distance = (game.Workspace.movethis.Position - workspace.gizmoright.Position).Magnitude
		print(distance)
		dragging = true
	end
end)
mouse.Button1Up:Connect(function()
	dragging = false
end)
game:GetService("RunService").RenderStepped:Connect(function()
	local mousepos3d = mouse.Hit.Position
	if dragging == true then
		game.Workspace.movethis.Position = workspace.gizmoright.Position + Vector3.new(distance,0,0)
		workspace.gizmoright.Position = Vector3.new(mousepos3d.X,workspace.gizmoright.Position.Y,workspace.gizmoright.Position.Z)--, workspace.gizmoright.Position.Y, workspace.gizmoright.Position.Z)
	end
end)

Bumping, because this is crucial to my game!