You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
Make the compass aim to the desired humanoidrootpart
What is the issue? Include screenshots / videos if possible!
The needle from the compass doesnt even move but when checking the properties everything seems right
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Tried to use the welds to change the rotation which actually worked but the rotation didnt even aim to the humanoidrootpart, yep
for i,v in pairs(game.Workspace:GetChildren()) do
if v.Name == "Hostile" then
while true do
local Arrow = script.Parent
local Hostile = v:FindFirstChild("HumanoidRootPart")
local x,y,z = CFrame.lookAt(Compass.Position,Hostile.Position):ToOrientation()
Arrow.Orientation = Vector3.new(0,y,0)
wait()
end
end
end
So you want the compass to only rotate around the Y axis?
Here is some code that might be simpler:
local compassYZero = Compass.Position - Vector3.yAxis * Compass.Position.Y
local hostileYZero = Hostile.Position - Vector3.yAxis * Hostile.Position.Y
-- Make a CFrame pointing in the direction only around the Y axis (with UpVector facing upwards)
local orientedCFrame = CFrame.lookAt(compassYZero, hostileYZero)
-- Set Arrow's CFrame to one with the orientation of `orientedCFrame` and position of Arrow's CFrame
Arrow.CFrame = orientedCFrame + Arrow.Position - orientedCFrame.Position
If you need the CFrame as an Orientation you can convert the orientedCFrame to an orientation using this code:
(Also the code above highlights a problem with your code: :ToOrientation outputs the rotations in radians, while .Orientation uses degrees.)
When dealing with trigonometry and directions for compass needles, you need to remember that 0° mathematically does NOT equate to 0° for navigation. In math, 0° would be due East. However, in navigation, 0° is due north. So you will need to add 90° to the math angle to get the navigation angle. I’m not sure if this is helpful, but it is a little gotcha that not too many people are aware of.