Rotate a part where player's mouse is

Hello,

So I’ve been trying to make it so the part can rotate in the player’s direction but failed. And I have no clue how to do it and make it happen.

I’ve searched google and found something with

part.CFrame = CFrame.new(part.CFrame.p,mouse.p)

Help would be really appreciated!

2 Likes

mouse.Hit.p, although you should use mouse.Hit.Position instead.

part.CFrame should be part.Position as well.

part.CFrame = CFrame.new(part.Position,mouse.Hit.Position)
-- that should work, but you can do
local mousep = mouse.Hit.Position
part.CFrame = CFrame.new(part.Position,Vector3.new(mousep.X,part.Position.Y,mousep.Z)
1 Like