Is there a better way checking when a projectile damages a player instead of using .Touched?

Alright so, this is my first post and forgive me if it’s a bit sloppy

I’m wondering if there’s a better alternate to check if a Projectile damages a Player upon Character contact, instead of using .Touched? There are some instances where the Part delays a bit before actually dealing the damage itself

Let’s say I insert a script inside the Projectile that has a BodyVelocity:

local Brick = script.Parent
local NoSpam = false

Brick.Touched:Connect(function(Hit)
	if NoSpam == false then
		NoSpam = true
		Brick.TweenAnimation.Disabled = false
		Brick.Parent.Anchored = true
		for i,v in pairs(game.Workspace:GetChildren()) do
			if v:FindFirstChild("Humanoid") and v:FindFirstChild("Torso") then
				if (v.Torso.Position - script.Parent.Position).Magnitude < 25 then
				    v.Humanoid:TakeDamage(30)
				end
			end
        end
	end
end)

Once it touches, it goes through all the Children inside the current Workspace (With pairs) to check if a Player (Or Humanoid) is far enough or close range using Magnitude

Now the thing, is that on some Instances, the moving Part takes a bit longer to Activate its Touched function (Might be because of the pairs & TweenScript as well but not sure)

Is there a better way to detect once a player has hit a certain projectile? Or is it just my code that’s really more or less wrong?

You can use the open source FastCast resource which simulates bullet physics with raycasting.

Whoa, I didn’t even realize this existed until now! Thanks a lot! Will try later! :smile:

I think this is already solved but, you can find pretty easy to learn raycast tutorials