Hello! I’m fairly new to scripting and my goal is to make a knife that you can stab and throw (like mm2 or assassin). Where should I start? I’ve heard people say things like raycasting and tweening to the end of the ray, but I’m not too sure how that works. I don’t need full scripts or anything, I just want to know where to begin. What’s the most efficient way to make a knife both stab and throw?
First of all,
Hitboxes
For hitboxes you need to NEVER use Touched.
Touched sucks and it should be inside the garbage can
There is alot of methods better than Touched. and works smoother
Touched sometimes fire when it doesnt even touch a part.
For other hitboxes example: Region3, raycast, magnitude
For stabbing hitboxes you can use either magnirude or region3
For projectile you can use raycasting
You should detect hitboxes on the client and do the checks on the server
Dont go like "OH CLIENT SUCKS EXPLOTAR EXPLOTAR MANAGE MANEG INSTA KILL GOD MODE KILL ALL"
No, you detect hitboxes on the client and do magnitude checks on the server
That way the physics act smoother and exploiters will go bye bye
For the velocity its not recommended to use tweening. I recommend you to use bodymovers or body velocities as they are more physics based and doesnt act janky.
Also for stabbing and throwing debounces you should manage it on the server unless you want some 9999 knife per second exploits inside your game
Thanks for the tips! Tomorrow I’ll experiment with some of the things you said. I appreciate the help!