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

I got a funny error(maximum event re-entrancy depth exceeded)?

Asked by 10 years ago

I think the error is because I'm doing something to many times, but this doesn't seam like it.. I don't know what I'm doing wrong, do you?

wait(.1)
local player=game.Players.LocalPlayer
local building=game.ReplicatedStorage.Buildings:FindFirstChild("Hut")
script.Parent.Equipped:connect(function(mouse)
copy=building:Clone()
copy.Parent=player.Character
end)
1
That error happens when events trigger off of each other too many times. All I can suggest here is to check if the "Hut" is connecting an event that causes an event triggering loop to occur. adark 5487 — 10y
0
I checked, and there is nothing connecting it to the "Hut", but is it bad that it's in a "BackPack" object? kingmatt2 15 — 10y
1
That shouldn't matter. Sorry guy, I can't help ya. adark 5487 — 10y
0
Okay, thanks, I'll try to do something else. kingmatt2 15 — 10y

2 answers

Log in to vote
0
Answered by
Ekkoh 635 Moderation Voter
10 years ago

Post the stack trace, it may not be this script.

Ad
Log in to vote
0
Answered by 10 years ago

Put a wait(0.01) after the Equipped event, like this:

wait(.1)
local player=game.Players.LocalPlayer
local building=game.ReplicatedStorage.Buildings:FindFirstChild("Hut")
script.Parent.Equipped:connect(function(mouse)
    wait(0.01)
    copy=building:Clone()
    copy.Parent=player.Character
end)

It should work

Answer this question