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 a part point in the direction of the mouse, using CFrame? [SOLVED]

I'm trying to make a realistic gun, and the bullets are propelled using lookVector. The thing with lookVector is is that the bullet has to be facing the target destination, in this case, where the mouse is pointing. This brings me back to the original question: How do I make a part point in the same direction that the mouse is pointing in?

1 comment

0

Anyone?

1 answer

✓ Accepted answer

No guarantees, but:

game:GetService("RunService").Stepped:connect(function()
part.CFrame=CFrame.new(part.CFrame.p, mouse.Hit.p)
end)

That SHOULD work, as it's something i've been using in my code for a while, just simplified. To work correctly, the part must be anchored.

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