Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Hello, aim part to mouse position...?

Asked by
x1op 0
10 years ago

Okay, so, I thought about making an arm that points to the direction my mouse is pointing but I can't figure out how in the world I could do that... I just don't understand how to do it. I've tried several times but I can't get it to work. I've also tried doing it with the cameras CFrame property or something but I get no result, in fact, sometimes my screen goes white and my character dies... Please let me understand how this scripts that make an object aim to the place that the mouse is pointing. Help is always appreciated, thanks!

1 answer

Log in to vote
0
Answered by 10 years ago

arm.CFrame=CFrame.new(arm.Position,mouse.Hit.p)

This will make the front of the arm face towards the position of the mouse. You will probably have to edit this, as I have not tested it.

0
Well, I've tried this already but it seems that mouse.Hit.p gets the lookVector of the mouse's cframe so if you make your arm rotate into that vector it would just rotate the same way the mouse does... x1op 0 — 10y
Ad

Answer this question