Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make the top of a part face the mouse?

I am trying to make the top of a part look at the mouse. I only used '' Part.CFrame = CFrame.new(Part.CFrame.UpVector,mouse.Hit.UpVector) ''

1 answer

✓ Accepted answer

try this - although I am not sure if it will work;

Part.CFrame = CFrame.new(Part.Position, mouse.Hit.p) * CFrame.Angles(0, 0, math.rad(90))

edit: I just tested it, it works

here's the code i used..

local Part = Instance.new("Part", workspace) do
	Part.Anchored = true
	Part.FrontSurface = Enum.SurfaceType.Motor
end
local mouse = game.Players.LocalPlayer:GetMouse()

mouse.Move:Connect(function()
    Part.CFrame = CFrame.new(Part.Position, mouse.Hit.p) * CFrame.Angles(0, 0, math.rad(90))
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.