Here's my script;

local Combat = script.Parent
local Animation = game.ReplicatedStorage:WaitForChild("CombatAnimation")
local Fighting = false
local Damage = script.Parent:WaitForChild("Damage")
local StaminaUse = script.Parent:WaitForChild("StaminaUse")
local CurrentStrength = Combat.Parent.Parent:WaitForChild("Status"):WaitForChild("CurrentStrength")
local CurrentStamina = Combat.Parent.Parent:WaitForChild("Status"):WaitForChild("CurrentStamina")
local CurrentStaminaStat = Combat.Parent.Parent:WaitForChild("Status"):WaitForChild("CurrentStaminaStat")
local ToolActivated = false
 
function onActivation()
    ToolActivated = true
    print("Combat Tool Activated")
    local Humanoid = Combat.Parent:WaitForChild("Humanoid")
    local anim = Humanoid:LoadAnimation(Animation)
    anim:Play()
    Fighting = true
    if Fighting == true then return end
        Fighting = true
            CurrentStamina.Value = CurrentStamina.Value - StaminaUse.Value
            CurrentStaminaStat.Value = CurrentStaminaStat.Value + StaminaUse.Value
            CurrentStrength.Value = CurrentStrength.Value + StaminaUse.Value
            Combat.Parent:WaitForChild("Right Arm").Touched:connect(function(Hit)
				if Hit.Parent:FindFirstChild("Humanoid") then
              		  Hit.Parent:WaitForChild("Humanoid").Health = Hit.Parent:WaitForChild("Humanoid").Health - Damage.Value
               		 	Combat.Parent:WaitForChild("Right Leg").Touched:connect(function(Hit)
						if Hit.Parent:FindFirstChild("Humanoid") then
                  		  	Hit.Parent:WaitForChild("Humanoid").Health = Hit.Parent:WaitForChild("Humanoid").Health - Damage.Value
                   		 	wait()
                   			Fighting = false
                   		 	if ToolActivated == false then
                   		 	 return
					end
                end
				            end)
				end
        end)
    end
 
Combat.Activated:connect(onActivation)

It has no errors. But then when it does do damage, it spams damages. I already try debounces. As you can see I made a lot of variables to try to prevent debounces. Please help. A lot of errors and problems.

3 comments

0

Title -> Has no errors - last line of question -> "A lot of errors and problems."

0

Is filtering enabled, and is this in a local script?

0

Sorry Ruben, I meant no errors in output but lot's of problems in game. FE is not enabled. This is a script