Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

1 comment

0

Thanks it kind of worked I decided I put the handle2 into the players left arm instead of the tool! Which works!

This discussion is preserved as it was. New answers, comments, and votes are closed.