Adding damage to an ability without parts

I want to add a way to make my beam do damage. I tried to use raycasting which would randomly stop damaging or the damage would multiply each time the ability used and I tried to use a part but the part would affect the movement of the beam.

I want the beam to do damage whilst the beam is ending on the target or going through them:

I think raycasting is the right method here, but you might want a debounce to keep the damage from going nuts.

While you are testing, I would print the results of the raycast and the damage inflicted so you can see if there is a particular part that is not registering damage. That would give you an idea why the code is failing.

Also, show us that code. This feels solvable. (and this looks great!) :smiley:


So I added the raycast back to showcase what I meant by the damage multiplying

---Server Script
Positioning.OnServerEvent:Connect(function(Player, Position)
		if Player.Name == FinalEffect.Name then
			FinalEffect.Position = Position
			HMRP.CFrame =,, HMRP.Position.Y, FinalEffect.Position.Z))
		local rayOrigin = HMRP.Position
		local rayDirection = (FinalEffect.Position)*1.1

		local raycastParams =
		raycastParams.FilterDescendantsInstances = {Character}
		raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
		local raycastResult = workspace:Raycast(rayOrigin, rayDirection, raycastParams)
		if raycastResult then
			local hit = raycastResult.Instance
			if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name ~= CharacterName.Name and hit.Parent:WaitForChild("Humanoid") ~= nil and hit.Parent:WaitForChild("Humanoid").Health ~= 0 and not hit.Parent:FindFirstChild("AlreadyHit") then
				if hit.Parent.Protected.Value == 0 then
					local VHumanoid = hit.Parent:WaitForChild("Humanoid")
					local touchEnd
						if hit.Parent.Protected.Value == 0 then
					until VHumanoid.Health == 0 or TorsoEffect.Parent ~= Torso					

-- Local Script

	if Input.UserInputType == Enum.UserInputType.MouseMovement and beaming == true then
		local BasePosition = HMRP.Position
		Mouse.TargetFilter = workspace:FindFirstChild(CharacterName.."streamhit")
		local Position = GetWorldPosition(BasePosition, Input.Position, 80)

My gut is telling me you need to have a disconnect on the event. The dummy keeps taking damage after you move the mouse away.

I don’t really see what you mean

Check out seconds 17-20 on your video. The dummy is still taking damage over time. It feels like “Positioning” continues long after you want it to… which suggests it might be running multiple connections, doing more and more damage.

I would investigate this condition specifically:

Is this working as intended? If not, the connection will deal damage until dead.

Positioning is run whenever mouse input is updated so the ending of the beam constantly has an updated position and I done “TorsoEffect.Parent ~= Torso” so when the beam is finished and the effect at the torso is destroyed, the script stops.

Double check that, because the dummy is definitely taking damage in that 3 second window when you are firing off to the side. Would explain the multiplying problem.

Yeah I noticed that but I’m not quite sure of how to remove it.

It’s interesting. You use mouse movement to call the event, so you could be calling the event hundreds of times.

Maybe test removing the repeat until loop entirely? It feels like it should still work, but without the multiplying effect.

May I add you on Discord as this is starting to flood this topic? Also I tried removing the repeat until and added print(Hit.Name) and even if the mouse doesn’t point at the dummy originally, it still prints that it hit it.