so im trying to make a compass with a part thats pointing to another part but the compass is a tool so i have to use motor6d and unanchored, but the problem is it always rotate on the Y axis it supposed to be rotating on the X axis. Heres the code (the main rotate function is RotatePartToFace() )
local motor6D = script.Parent.Union.Motor6D
local targetPart = workspace.Camp.CampFire:WaitForChild("InteractPart")
local tool = script.Parent
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local connected
local function RotatePartToFace()
local lookVector = (script.Parent.Point.CFrame.p - targetPart.Position).Unit
motor6D.C0 = CFrame.new(Vector3.new(0.05, 0, 0), lookVector)
end
local function OnToolActivated()
connected = RunService.Heartbeat:Connect(RotatePartToFace)
end
local function OnToolDeactivated()
if connected then
connected:Disconnect()
end
end
tool.Activated:Connect(OnToolActivated)
tool.Deactivated:Connect(OnToolDeactivated)