Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why this error keeps happening? Maximum event re-entrancy depth

Asked by 7 years ago

When i was scripting a knife for my murder game,i ve got both these errors:

Maximum event re-entrancy depth exceeded for Tool.Equipped

While entering function defined in script 'Players.Player1.Backpack.Default Knife.Script', line 34

And i don't know what to do. Here is my complete Tool.Equipped event

tool.Equipped:connect(function()
    h=tool.Parent.Humanoid
    local sound=Instance.new('Sound',tool)
    sound.SoundId='rbxassetid://'..sounds.equip
    sound:Play()
    sound:Destroy()
    mouseDownCon=mouseDown.OnServerEvent:connect(function()
        if not canKill then
            canKill=true
            local anim=Instance.new('Animation',tool)
            anim.AnimationId='rbxassetid://'..animations.stabs[math.random(1,3)]
            animTrack=h:LoadAnimation(anim)
            animTrack.Priority=Enum.AnimationPriority.Action
            animTrack:Play()
            local sound=Instance.new('Sound',tool)
            sound.SoundId='rbxassetid://'..sounds.striking[math.random(1,4)]
            sound:Play()
            wait(.3)
            animTrack:Stop()
            canKill=false
            anim:Destroy()
            sound:Destroy()
        end
    end)
end)
0
Are you missing something? The error is on line 34, but there's only 25 lines TheHospitalDev 1134 — 7y
0
The tool.Equipped event starts at line 34 arthurgps2 67 — 7y

Answer this question