I'm trying to get this part to look at the mouse position. This is what I have:
local Mouse = game.Players.LocalPlayer:GetMouse() local Part = workspace.Part Part.CFrame = CFrame.new(Part.CFrame, Mouse.Hit.p)
(Im using RenderStepped in the actual code, to keep the CFrame updated) This code will get the part to look at my mouse position. But the part is rotating using all of its axis points, how would I get the part to look at my mouse position using only its Y cord?
Please note that GetMouse().Hit returns a read only CFrame. If you wish the part to become at the position of the mouse;
Part.CFrame =Mouse.Hit
if on the other hand you wish for the part to go halfway;
Part.CFrame = Part.CFrame * Mouse.Hit
if you only wish to use the y co-ordinate, then it would look like this;
Part.CFrame = CFrame.new(Part.CFrame.x,Mouse.Hit.y,Part.CFrame.z)
I wasn't very sure what you were trying to do, so I just explained how the line would look accordingly. I hope I helped, have a good day!