How can I make a gun? I don’t understand how to use the mouse position and velocity
What I want
-
No tool
-
It uses CFrame
Thank you for reading.
How can I make a gun? I don’t understand how to use the mouse position and velocity
What I want
No tool
It uses CFrame
Thank you for reading.
To handle firing, I suggest you use a module called fast cast. To handle the equipping and unequipping, you can use ContextActionService to bind functions to inputs.
In terms of using CFrame, you need to be a bit more specific. I would suggest using animations for firing and reloading instead of lerping only because it is significantly more efficient.
This should provide you with a solid place to start.
:ScreenPointToRay()
allows you to find the position of the mouse in the 3d world, then you can just raycast for hit detection.
If you don’t want to use tools, you can just weld the gun to the player or add it as an attatchment
Im not sure what you mean by using cframe tho
Another alternative that takes less work is getting the player mouse and using the Mouse.Hit property
Though I recommend what @0Luke_Skywalker0 said