You can write your topic however you want, but you need to answer these questions:
-
Problem
When the first animation is being played, it doesnt damage the dummy. it only damages it when i touch its body again -
Video of the Problem
2021-08-02 19-27-10 -
What solutions have you tried so far?
I’m currently finding a way to fix this
local db = false
local dbcombo = false
local combo = 0
local canhit = false
local idle1 = script.Parent.idle1
local punch1 = script.Parent.punch1
local punch2 = script.Parent.punch2
local tool = script.Parent
tool.Activated:Connect(function()
if db == false then
if combo == 0 then
db = true
combo = 1
local track
track = script.Parent.Parent.Humanoid:LoadAnimation(punch1)
--track.Priority = Enum.AnimationPriority.Action
track:Play()
-- dmg
local Larm = script.Parent.Parent:FindFirstChild("Right Arm")
Larm.Touched:Connect(function(hit)
local chr = hit.Parent
local hum = chr:FindFirstChild("Humanoid")
if hum then
if canhit == false then
hum.Health = hum.Health -10
canhit = true
end
end
end)
wait(1)
canhit = false
track:Stop()
db = false
elseif combo == 1 then
db = true
combo = 0
canhit = true
local track
track = script.Parent.Parent.Humanoid:LoadAnimation(punch2)
--track.Priority = Enum.AnimationPriority.Action
track:Play()
-- dmg
local Larm = script.Parent.Parent:FindFirstChild("Left Arm")
Larm.Touched:Connect(function(hit)
local chr = hit.Parent
local hum = chr:FindFirstChild("Humanoid")
if hum then
if canhit == false then
hum.Health = hum.Health -10
canhit = true
end
end
end)
wait(1)
track:Stop()
canhit = false
db = false
end
end
end)
If you can help me, please tell me what should i put in the script.