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

How do you fix 'Maxium event re-entrancy depth exceeded'?

Asked by 7 years ago

So I've combined some stuff to make this anyway the error says how do I fix this everything works fine on it except for the tool animation doesn't stop on unequip and its really ticks me off in my output

22:51:42.670 - Maximum event re-entrancy depth exceeded for Tool.Equipped 22:51:42.672 - While entering function defined in script 'Players.Player1.Backpack.Daggers.LocalScript', line 102

function dualhandles()
if handle and plyr and char then
    handle2 = handle:Clone()
    handle2.Name = "Handle2"
    handle2.CanCollide = false

    handle2weld = Instance.new("ManualWeld")
    handle2weld.Part1 = handle2
    handle2weld.C0 = CFrame.new(0, -1, 0, 1, 0, -0, 0, 0, 1, 0, -1, -0)
    handle2weld.C1 = tool.Grip

    local larm = char:FindFirstChild("Left Arm")
    handle2weld.Part0 = larm
    handle2weld.Parent = handle2
    handle2.Parent = tool
    end
end

tool.Unequipped:connect(function()
    handle2:Destroy()
    animation:Stop()
end)

tool.Equipped:connect(function()
    dualhandles()
    animation = human:LoadAnimation(idle)
    animation:Play()
end)

1 answer

Log in to vote
0
Answered by 7 years ago

Well, not entirely sure on the output error, but note that you have handle2 defined in dualhandles(), yet you try to access it in your unequipped event. This shouldn't work - you're going to want to do something along the lines of

tool:WaitForChild("handle2"):Destroy()

to prevent that.

0
Thanks it kind of worked I decided I put the handle2 into the players left arm instead of the tool! Which works! rareheaddress 74 — 7y
Ad

Answer this question