Problem with changing rotation in accessory

  1. What do you want to achieve? I want to make the rotation of the accessoire, but when I use my script everything works fine until I start moving the other axis

  2. What is the issue?

Here’s the script:

local rotationModule = {}

local player = game:GetService("Players").LocalPlayer

local GUI = player.PlayerGui:WaitForChild("GUI")
local handles = GUI:WaitForChild("InteractionThings"):WaitForChild("RotationHandles")

local basicWalkSpeed = player.Character:WaitForChild("Humanoid").WalkSpeed

local axisangle = nil
local relativeAngled = nil

local previousCFrame = nil

handles.MouseButton1Down:Connect(function()
	previousCFrame = handles.Adornee.CFrame

	player.Character:WaitForChild("Humanoid").WalkSpeed = 0

	handles.Adornee:FindFirstChildWhichIsA("Motor6D").Enabled = false
	handles.Adornee.Anchored = true
	
	player.Character:WaitForChild("Head").Anchored = true
	
	for i,v in pairs(player.Character.Humanoid:GetPlayingAnimationTracks()) do
		v:Stop()
	end
end)

handles.MouseDrag:Connect(function(axis,relativeAngle,deltaRadius)
	local axisangle = Vector3.FromAxis(axis)
	axisangle = axisangle * relativeAngle

	relativeAngled = axisangle
	handles.Adornee.CFrame = previousCFrame * CFrame.Angles(axisangle.X, axisangle.Y, axisangle.Z)
end)

handles.MouseButton1Up:Connect(function()
	player.Character:WaitForChild("Humanoid").WalkSpeed = basicWalkSpeed

	handles.Adornee.Anchored = false
	handles.Adornee:FindFirstChildWhichIsA("Motor6D").Enabled = true
	player.Character:WaitForChild("Head").Anchored = false

	local currentC0 = handles.Adornee:FindFirstChildWhichIsA("Motor6D").C0
	handles.Adornee:FindFirstChildWhichIsA("Motor6D").C0 = currentC0 * CFrame.Angles(-relativeAngled.X, -relativeAngled.Y, -relativeAngled.Z)
end)


return rotationModule

Print out what your relativeAngled, currentC0 and previousCFrame are equal to in the MouseButton1Up function. I have a suspicion you aren’t setting relativeAngled properly.