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

Maximum event re-entrancy depth exceeded?

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?

1 comment

0

Edited it, I make to many typo's.

1 answer

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 :)

6 comments

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.
0

Whoops, I made a fix out of my typo.

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)?

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.

0

I edited, q.q

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?

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