I am trying to make a part rotate towards my mouse. Kinda like a compass where the red arrow always pointing towards the earth's magnetic north pole. So what i want is that the part rotates so it points towards my mouse. The only problem is that it also rotates in the x-axis when i only wants it to rotate in the y-axis.
If you need me to exlpain better then tell me.
I have tried this
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local part = workspace.Part
while wait() do
part.CFrame = CFrame.new(part.Position,mouse.hit.p)
end
I have also tried
part.CFrame = CFrame.new(part.Position.y,mouse.hit.y)
--instead of
part.CFrame = CFrame.new(part.Position,mouse.hit.p)
But it gives me a error: bad argument #1 to 'new' (Vector3 expected, got number)

1 comment
Thanks it works now :)