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

Maximum event re-entrancy depth exceeded?

Asked by
emite1000 335 Moderation Voter
9 years ago
script.Parent.Equipped:connect(function()
    Guu = Workspace:FindFirstChild("ScreenGui")
    Gu2 = Guu:Clone()
    Gu2.Parent = script.Parent.Parent
end)

So I was playing around with Guis today, and after writing a simple script to make a Gui appear when a tool is equipped, I was greeted with no Gui and instead this message: maximum event re-entrancy depth exceeded

The Wiki says that it "is caused by too many events triggering each other", but I'm not sure what that means. What is wrong with my script?

0
Edited it, I make to many typo's. HexC3D 830 — 9y

1 answer

Log in to vote
1
Answered by
HexC3D 830 Moderation Voter
9 years ago
script.Parent.Equipped:connect(function()
    player = script.Parent.Parent.Parent 
player:WaitForDataReady("StarterGui").ScreenGui -- Make a screengui in StarterGui
 Guu:Clone().Parent = player:WaitForDataReady("StarterGui")  -- You can't clone StarterGui, it a service but you can clone a screengui
end)



maximum event re-entrancy depth exceeded Means that you used the Gu2 the clone more than once though I fixed and it should work. The script creates the Clone of the Gui on the spot and will not exceed the entrance.

+1 if the helped and make sure this question is considered answered if I helped,mk :)

0
1. When did I use Gu2 too many times? The first time I mentioned it I was only defining it, not actually creating a clone. 2. Putting your script in doesn't work because "there is an unaxpected symbol near =" in line 3. emite1000 335 — 9y
0
Whoops, I made a fix out of my typo. HexC3D 830 — 9y
0
Still got the same error message when using your script. Also, I realized the place I am cloning it to is into the Player in Workspace, not the player in Players. How do I make the connection between the Player's Workspace character and their Players data (so I can get to the PlayerGui)? emite1000 335 — 9y
0
Figured it out. My problem was not that I used Gu2 too many times (my original script worked fine), it's that I was targeting to the wrong spot. script.Parent.Parent is the Player in the Workspace, not their PlayerGui. emite1000 335 — 9y
View all comments (2 more)
0
I edited, q.q HexC3D 830 — 9y
0
#1: script.Parent.Parent.Parent is Workspace, because the script is in a Tool in a Player. #2: When you say player:WaitForDataReady("StarterGui").ScreenGui, how does that make a screengui in StarterGui? Because all WaitForDataReady does is wait for saved data to be ready to be accessed. It doesn't create things? emite1000 335 — 9y
Ad

Answer this question