#My code runs twice and then thrice...

23 messages · Page 1 of 1 (latest)

vague elm
#

I'm trying to make a location in my game in which you can eat hotdogs. The problem is that when I return to that region, the code from the value of the eated hotdogs is running twice and then thrice. I tried to use prints but it gives me the same result, the printed log repeated twice and thrice.

#

Here I'll give some screenshots of the issue:

#

and the code:

#

Well, while making the screenshots, I realize that in the logs it counts the numbers normally.

hoary hearthBOT
#

studio** You are now Level 1! **studio

vague elm
#

So I guess that I have to make a video for the better understanding of the problem

civic laurel
#

can you show the code per chance?

vague elm
#

this is the important bit

civic laurel
#

maybe you could use a boolean variable to make sure it fires once..? like

local FireOnce = true
etc etc etc

and then yeet it once it fires once haha

if FireOnce then
FireOnce = false

id defo wait for a second opinion, im mostly a newbie gui scripter...

vague elm
#

Oh, I did make one. That's what the debounce function does

civic laurel
# vague elm

ooooo i see now, hm defo wait for someone more experienced

vague elm
#

thanks anyways 👌

civic laurel
# vague elm thanks anyways 👌

if you haven't figured this out, i think the issue might be wait the way MouseButton1Click is connected to the debounce function 🤔

also is there something meant to happen when it reaches 10?

((i wanted to try and help you some more haha))

feral scarab
#

@vague elm did you still need help?

vague elm
vague elm
#

The main problem is, that I don't know why my function is running twice and then thrice

#

the code is up above

feral scarab
# vague elm Yes 😁

you sure ensure that each connection is made only once with your onclientevent intialization