#GetMarkerReachedSignal happens only once

1 messages · Page 1 of 1 (latest)

silver coral
#
local tool = script.Parent

local anims = game.ReplicatedStorage:WaitForChild("Anims")
local mp = anims:FindFirstChild("Mini Pekka")
local Slash = mp:FindFirstChild("Slash")

local HitboxModule = require(game.ReplicatedStorage:WaitForChild("Hitbox"))

local newHitbox = HitboxModule.New()

local cd = false

tool.Equipped:Connect(function()
    if cd == false then
        tool:Activate()
    end
end)

tool.Activated:Connect(function()
    if cd then return end
    
    cd = true
    
    char = tool.Parent
    hrp = char:FindFirstChild("HumanoidRootPart")
    hum = char:FindFirstChild("Humanoid")
    
    local hitboxCFrame = hrp.CFrame * CFrame.new(0,0,-5)
    local hitboxSize = Vector3.new(5,5,5)
    
    local createHitbox = workspace:GetPartBoundsInBox(hitboxCFrame, hitboxSize)
    
    local attack = hrp:FindFirstChild("Attack")
    local pancakes = hrp:FindFirstChild("Pancakes")
    local hit = hrp:FindFirstChild("Hit")

    local slashtrack = hum.Animator:LoadAnimation(Slash)
    
    hum:UnequipTools()
    
    slashtrack:Play()
    attack:Play()

    task.wait(.75)
    
    attack:Stop()
    
    slashtrack:GetMarkerReachedSignal("Hit"):Connect(function()
        task.spawn(function()
            HitboxModule:StartD(char, .3)
        end)
        
        local victim = {}
        
    for _, v in pairs(createHitbox) do
        
        if v.Parent:FindFirstChild("Humanoid") and not victim[v.Parent.Name] and v.Parent ~= char then
            
            vhum = v.Parent:FindFirstChild("Humanoid")
            
            victim[v.Parent.Name] = true
            
            vhum:TakeDamage(10)
            hit:Play()
        end
    end
        
        
    end)
    for i = 12, 0, -1 do
        print(i)
        wait(1)
    end
    cd = false
end)
#

the hitbox works the first time but when i try to use it again its like the keyframe event disappears

#

the hitbox doesnt appear again

white compass
#

send video maybe?

scarlet geyserBOT
#

studio** You are now Level 5! **studio

silver coral
#

@white compass

white compass
#

you have an error on 61 btw, make sure to say ‘’local’’

silver coral
#

ik

#

i just do it so i can mention it later if i need it

#

can u help me

#

@white compass