| Why am I exceeding the re-entrancy depth? | |
|
|
Author | Message |
---|
tgp1994 Intermediate Scripter
Posts : 17 Join date : 2012-06-27
| Subject: Why am I exceeding the re-entrancy depth? September 27th 2012, 7:38 pm | |
| Hi everyone, I'm having a weird issue where, when my tool is equipped, my onSelected function runs six times, then the script is terminated, with the output saying maximum event re-entrancy depth exceeded. Looking at a snippet of my code, - Code:
-
me = nil --Tools are placed in the Character model when they're taken out, this variable must be set once the tool is taken out. msg = nil
function onSelected(mouse) print("Selected Local") me = script.Parent.Parent mouse.Icon = Cursor["gun"] --mouse.Button1Down:connect(function() onButton1Down(mouse) end) --mouse.Button1Up:connect(function() onButton1Up(mouse) end) --mouse.Idle:connect(function() Idle(mouse) end) --mouse.KeyDown:connect(keypush) msg = Instance.new("Message") msg.Parent = me msg.Text = "" print("Message placed in "..tostring(me)) end
bin.Equipped:connect(onSelected) can anyone tell why this function is being repeated multiple times when it should only run once? | |
|
| |
m27frogy The Garbageman
Posts : 336 Join date : 2011-06-23
| Subject: Re: Why am I exceeding the re-entrancy depth? October 28th 2012, 8:14 pm | |
| This error means that too many events immediatly fire the same event which fires the same event again and into infinity.... | |
|
| |
tgp1994 Intermediate Scripter
Posts : 17 Join date : 2012-06-27
| Subject: Re: Why am I exceeding the re-entrancy depth? October 28th 2012, 9:34 pm | |
| Thanks for the help frogy,
I posted this on the roblox forums, and it turned out to be something a little more complicated than that - it actually was a bug in roblox its self. The suggested temporary workaround was to put a wait(0) command at the beginning of the hooked function that was causing the issue. I hope this bug gets fixed soon :\ | |
|
| |
m27frogy The Garbageman
Posts : 336 Join date : 2011-06-23
| Subject: Re: Why am I exceeding the re-entrancy depth? October 30th 2012, 4:41 pm | |
| That is odd, I'm glad your issue was fixed! PS, you might want to update your avatar. I change d it for you! ;) | |
|
| |
branefreez Intermediate Scripter
Posts : 143 Join date : 2012-07-14
| Subject: Re: Why am I exceeding the re-entrancy depth? October 31st 2012, 12:45 pm | |
| do
[code]local debounce = true
if (debounce == true) do blah blah onEquipped blah blah debounce = false
STUFF................ end | |
|
| |
tgp1994 Intermediate Scripter
Posts : 17 Join date : 2012-06-27
| Subject: Re: Why am I exceeding the re-entrancy depth? October 31st 2012, 1:41 pm | |
| - m27frogy wrote:
- PS, you might want to update your avatar. I change d it for you! ;)
Oh, was that thing old? I never really noticed, thanks for getting it for me though :) - branefreez wrote:
- do
[code]local debounce = true
if (debounce == true) do blah blah onEquipped blah blah debounce = false
STUFF................ end
Yeah, it was the weirdest thing... I actually tried the debounce method first (that was the first suggestion over at roblox), and for some reason, (as best as I can remember) I was still getting the same results, more or less. I don't completely understand why that wouldn't work where the wait(0) method would, but I sure like it since it's less code :) | |
|
| |
m27frogy The Garbageman
Posts : 336 Join date : 2011-06-23
| Subject: Re: Why am I exceeding the re-entrancy depth? October 31st 2012, 2:46 pm | |
| | |
|
| |
branefreez Intermediate Scripter
Posts : 143 Join date : 2012-07-14
| Subject: Re: Why am I exceeding the re-entrancy depth? November 1st 2012, 3:27 pm | |
| It is.... But it's nice to know that there are more than just two people active on the forum. | |
|
| |
tgp1994 Intermediate Scripter
Posts : 17 Join date : 2012-06-27
| Subject: Re: Why am I exceeding the re-entrancy depth? November 1st 2012, 5:43 pm | |
| Hate to go offtopic, but is activity an issue here? | |
|
| |
branefreez Intermediate Scripter
Posts : 143 Join date : 2012-07-14
| Subject: Re: Why am I exceeding the re-entrancy depth? November 1st 2012, 7:16 pm | |
| Nope. Not really, but I was just showing my happiness that you are also active. | |
|
| |
tgp1994 Intermediate Scripter
Posts : 17 Join date : 2012-06-27
| Subject: Re: Why am I exceeding the re-entrancy depth? November 1st 2012, 7:21 pm | |
| Oh, why thank you :) I'm glad to be active here. | |
|
| |
m27frogy The Garbageman
Posts : 336 Join date : 2011-06-23
| Subject: Re: Why am I exceeding the re-entrancy depth? November 2nd 2012, 12:17 pm | |
| Well, I'll promote you, since I can see you're better than a novice. :D | |
|
| |
branefreez Intermediate Scripter
Posts : 143 Join date : 2012-07-14
| Subject: Re: Why am I exceeding the re-entrancy depth? November 2nd 2012, 3:04 pm | |
| That's very kind of you to do for him. Thank you! And, Welcome to being a Moderate Scripter, tgp1994! | |
|
| |
tgp1994 Intermediate Scripter
Posts : 17 Join date : 2012-06-27
| Subject: Re: Why am I exceeding the re-entrancy depth? November 2nd 2012, 6:34 pm | |
| Thank you both :) I wish I was more active on ROBLOX to better deserve the title, but I appreciate it nonetheless. | |
|
| |
branefreez Intermediate Scripter
Posts : 143 Join date : 2012-07-14
| Subject: Re: Why am I exceeding the re-entrancy depth? November 3rd 2012, 2:01 pm | |
| Hey, as long as you are active to some extent, we appreciate it. You are helping to keep the forum alive.
| |
|
| |
m27frogy The Garbageman
Posts : 336 Join date : 2011-06-23
| Subject: Re: Why am I exceeding the re-entrancy depth? November 5th 2012, 8:01 pm | |
| Yup. Couldn't have coined it better. | |
|
| |
MrNicNac Expert Scripter
Posts : 27 Join date : 2011-03-06 Age : 28
| Subject: Re: Why am I exceeding the re-entrancy depth? November 13th 2012, 9:07 am | |
| If you're still having issues with this, I can look at the code for you and definitely give you a fix. I've had problems like this multiple times. | |
|
| |
branefreez Intermediate Scripter
Posts : 143 Join date : 2012-07-14
| Subject: Re: Why am I exceeding the re-entrancy depth? November 13th 2012, 4:07 pm | |
| Hey, MrNicNac! Nice to see you, again! [Even though I've never met you>:3 ]. I'm sure they would love having your help on their probloems. | |
|
| |
tgp1994 Intermediate Scripter
Posts : 17 Join date : 2012-06-27
| Subject: Re: Why am I exceeding the re-entrancy depth? November 13th 2012, 11:35 pm | |
| I appreciate the offer, MrNicNac! I think the wait command actually worked very well for the script (and for me, I might add :P) If you have a better solution, would you mind posting it here so the community can benefit from it? | |
|
| |
MrNicNac Expert Scripter
Posts : 27 Join date : 2011-03-06 Age : 28
| Subject: Re: Why am I exceeding the re-entrancy depth? November 14th 2012, 9:21 am | |
| No, my offer would have been to add a wait somewhere as well.
I just have to ask, however, did you use a LocalScript? | |
|
| |
tgp1994 Intermediate Scripter
Posts : 17 Join date : 2012-06-27
| Subject: Re: Why am I exceeding the re-entrancy depth? November 14th 2012, 9:28 pm | |
| - MrNicNac wrote:
I just have to ask, however, did you use a LocalScript? I'm trying to think back... I was going back and forth between a LocalScript and a regular script, because I needed to interact with the world, yet I was hearing stories that the localscript would be a solution (although I don't remember switching to one actually fixing anything). It seemed like it would be much more easier leaving the script as a serverside script, so I think I may have left it serverside. | |
|
| |
Sponsored content
| Subject: Re: Why am I exceeding the re-entrancy depth? | |
| |
|
| |
| Why am I exceeding the re-entrancy depth? | |
|