Stand rush/Barrage help

  1. What do you want to achieve? I have an animation that kinda resembles a stand barrage from Jojo’s bizarre adventure. I am trying to have it do fluent damage

  2. What is the issue? It just instantly kills the target. I use this same script for all of my other attacks but tried to implement a loop.

  3. What solutions have you tried so far? I’ve tried looping and manuel, none worked.

LocalHumPart = script.Parent:FindFirstChild("HumanoidRootPart")
Character = script.Parent
Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://5471634980"

function Barrage(player)
	if game.Players:GetPlayerFromCharacter(script.Parent) == player then
		if LocalHumPart.Stand.Value == true then
			if script.Parent:FindFirstChild("Pose").Pose.Value == false then
				if LocalHumPart.CanAttackRN.Value == true then
					local Stand = script.Parent:WaitForChild("Stand")
					local Barrage = 0
					local playAnim = Stand.AnimationController:LoadAnimation(Anim)
					playAnim:Play()
					repeat
						local touch = false
						Stand:FindFirstChild("Left Arm").Touched:Connect(function(part)
							Hum = part.Parent:FindFirstChild("Humanoid")
							if Hum then
								touch = true
							else
								touch = false
							end
						end)
						if touch == true then
							touch = false
							Hum.Health = -2
						end
						Barrage = Barrage + 1 
						wait(0.2)
						Stand:FindFirstChild("Right Arm").Touched:Connect(function(part)
							Hum = part.Parent:FindFirstChild("Humanoid")
							if Hum then
								touch = true
							else
								touch = false
							end
							Barrage = Barrage + 1 
						end)
						if touch == true then
							touch = false
							Hum.Health = -3
						end
					until Barrage == 30
				end
			end
		end
	end
end

game.ReplicatedStorage.Folder.TheWorld1.AttackE.OnServerEvent:Connect(Barrage)

thanks!

1 Like

Add some sort of offset somewhere like a wait(3) or something so that your loop isn’t instant and it will wait a few seconds before each loop

1 Like

The problem is that it is still instantly killing the NPCs, I’m not sure whats causing this.

Try doing a .TouchEnded and setting touch to false

it still doesn’t seem to work, its fine ill try something else, thanks for the help tho

I know I’m very late but instead of touched use a repeat until looped with magnitude damage.
Example:

local BarrageDb = false
local isBarraging = false

local function BarrageButtonDown()
	if BarrageDb then return end
	isBarraging = true
	local Barrage = "Animation Track Here"
	Barrage:Play()
		
	delay(4.65,function() --// This is how long you can hold the barrage key down before you can't continue
		if isBarraging then
			isBarraging = false
		end
	end)
		
	repeat wait(0.075) --// or how long per hit
		for i,v in pairs(workspace:GetChildren()) do
			if v:IsA("Model") and v:FindFirstChild("HumanoidRootPart") and v:FindFirstChildOfClass("Humanoid") then
				if (("InsertWhereYourStandIsLocated").HumanoidRootPart.Position - v:FindFirstChild("HumanoidRootPart").Position).Magnitude <= 10.5 then --// 10.5 is kinda large ik but you can make the number smaller so you need to be closer to do damage.
					if plr.Character ~= v then
						--// Do Damage, v is the model that you are trying to do damage to
					end
				end
			end
		end
	until not isBarraging
		
	Barrage:Stop()

	BarrageDb = true
		
	isBarraging = false

	local Cooldown = 5.5
		
	delay(Cooldown,function()
		BarrageDb = false
	end)
end

local function BarrageButtonUp()
	if BarrageDb then return end
	if isBarraging then
		isBarraging = false
	end
end

I used a similar version of this for my jojo game and it works fantastic.

Once again really sorry that I’m so late.

.Touched is very unreliable you should probably use magnitude or region3.

3 Likes

Because you’re using magnitude wouldn’t it try to find players behind and infront the stand?

1 Like

Your Correct, it just depends how you want your stand to detect damage you could use region3 but yeah. If your number is low it shouldn’t be a issue.

2 Likes

Just disconnect the event after the humanoid takes damage.

2 Likes

From the first script provided, it just seems that your setting the targets health to -3
if you used :TakeDamage() or Hum.Health = Hum.Health - 2 I think it’d work
image

1 Like

OR use -= instead of having to repeat .Health again.

1 Like