Raycast Projectile Module with RaycastHitboxv4!

NEW VERSION HERE!!! : Raycast Projectile Module V2! (kinda)

Hello! While trying to use other modules, I noticed that the projectile would sometimes bug out and get shaky, or cause lots of unnessesary stress to the server, so I decided to make this! It uses RaycastHitboxv4 for hit detection and heartbeat for movement so its as accurate as possible!

Ive made it as customizable as possible, allowing users to change the shotPart, visualizer, destroy distance, shotspeed, starting point, and end point!

How To Use

Create a new server script, and insert the code –

local RCPMod = require(script.Parent["Raycast Projectile Module"])

game.ReplicatedStorage.projectile.OnServerEvent:Connect(function(plr, mouseP)
	local infoTbl = {
		part              = workspace.SHOTPART:Clone(),
		sizeGap           = 1,
		destroyDistance   = 100,
		shotSpeed         = 25,
		startingPoint     = plr.Character.HumanoidRootPart.CFrame,
		shotDirection     = mouseP,
		visualizer        = true,
		plr               = plr
	};
	infoTbl.part.CanCollide = false
	RCPMod.Fire(infoTbl)
end)
How It Works

This uses OOP to seamlessly move, scan, and control all parts and values.

It moves the parts with Heartbeat, that way you can have as many projectiles firing at once as you need, and all the projectiles move extremely well.

The RaycastHitbox module allows for extremely accurate detections alongside debugging visualizers that allow you to see why the hitbox size, and why the projectile may not be working.

Instead of automatically doing damage and effects, it returns the character that it hits (then automatically disables its self and removes all remaining values), that way, you can add your own custom damage and hit effects that fit your game!

Please Note this is my first time using OOP, so please give me feedback so I can make the module run better, and with less bugs

idk how to use github, so get the module here -
RaycastProjectileModule_Update2.rbxm (18.1 KB)

Update2 Video :
Uploading: 2022-08-01 20-46-18.mp4…

9 Likes

Provide screenshots or videos of the module in action.

2 Likes

I have added a video + a few updates so it works more smoothly

Sorry to be the one to say this, but why not directly use Raycasts? The RaycastHitbox is meant for a completely different use case.

2 Likes

I thought about doing that, but the way raycasting hit box works, I think it would just be overall more efficient and effective - although I might add an option for normal raycasting later so you can change it to fit your needs

Great module! The file seems to be outdated though, I don’t have the On Hit module.

1 Like

That may be because when I create the new file I keep the name - I’ll fix that once I get home

Is there a way for this to work while it isn’t moving? I want to replace .Touched event with this.

You should just use the normal raycasting hit box module, or if you really have to just create a projectile that doesn’t move and has a destroy distance of 1

UPDATE :
created a hitbox in all corners instead of just the middle
fixed file not working
added :GetCorners() function, made by @debugger57
fixed speed being affected by distance
fixed destroy distance bug
added example folder for a better understanding of how to use the module

Version 1.00.20

Here is what I use the module for in my game : 2022-08-04 10-56-10

Here is an example tool that you can test out :
ProjectileExample.rbxm (2.9 KB)

1 Like

how can I create a projectile that doesnt move?

new version : Raycast Projectile Module V2! (kinda)