There were no errors in the output but I couldn't figure out the problems;
Here's my full 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")
print("All Variables Defined")
function onActivation()
if CurrentStamina.Value >= 10 then
Damage.Value = 6
print("Combat Tool Activated")
local Humanoid = Combat.Parent:WaitForChild("Humanoid")
local anim = Humanoid:LoadAnimation(Animation)
anim:Play()
print("Playing Animation")
CurrentStamina.Value = CurrentStamina.Value - StaminaUse.Value
CurrentStaminaStat.Value = CurrentStaminaStat.Value + StaminaUse.Value
CurrentStrength.Value = CurrentStrength.Value + StaminaUse.Value
print("Added and Subtracted all stats")
Combat.Parent:WaitForChild("Right Arm").Touched:connect(function(Hit)
if not Fighting then
Fighting = true
Damage.Value = 6
if Hit.Parent:FindFirstChild("Humanoid") then
Hit.Parent:WaitForChild("Humanoid").Health = Hit.Parent:WaitForChild("Humanoid").Health - Damage.Value
if Fighting then
Fighting = false
Damage.Value = 0
wait()
print("Combat Right Arm Has been completed")
Combat.Parent:WaitForChild("Right Leg").Touched:connect(function(Hit)
if not Fighting then
Fighting = true
Damage.Value = 6
if Hit.Parent:FindFirstChild("Humanoid") then
Hit.Parent:WaitForChild("Humanoid").Health = Hit.Parent:WaitForChild("Humanoid").Health - Damage.Value
wait()
if Fighting then
Fighting = false
Damage.Value = 0
print("Completed")
end
end
end
end)
end
end
end
end)
end
end
Combat.Activated:connect(onActivation)
Any ideas of what I did wrong or what went wrong? Any feedback will help.
Note; It worked once but the next time I activated the tool it did no dmg but the animation played.
