So i have this looped function, once the other player is hit they take damage and this little shock wave appears, but each loop the damage increases and more shock waves are added, i'm not sure what's causing this. Script -

---------------------------------------------------------	
HBoxes.Touched:Connect(function(hit)---------------------
---------------------------------------------------------
		local Humanoid = hit.Parent:FindFirstChild("Humanoid")
		if Humanoid and Check and Barrage == true then
			Check = false
			Humanoid:TakeDamage(BarrageDamage)
			local Wave = RS:WaitForChild("Hit"):Clone()
			Wave.Parent = hit.Parent:FindFirstChild("Torso")
			Wave.Position = hit.Parent:FindFirstChild("Torso").Position
			Wave.Size = Vector3.new(math.random(4,10),math.random(1,3),math.random(1,3))
			Wave.Orientation = Vector3.new(math.random(0,360),math.random(0,360),math.random(0,360))
			Wave.SFX:Play()
			wait(0.05)
			Wave:Destroy()
			Check = true
		end
	end)
end)

5 comments

0

what is "check"

0

also what is barragedamage

0

post whole script, not just a snippet

0

barragedamage is some kind of numbervalue and im guessing check is a debounce

0

Check is a Variable set to true, BarrageDamage is a Int Value