#Connected functions question

1 messages · Page 1 of 1 (latest)

noble patrol
#

in this script, if the action is diceshake and i connect getattributechangedsignal, does that connection stay after the soundEvent:OnClientEvent is all done? or will this connection disconnect after the soundEvent function has completed

sturdy charm
#

yes it does its a source of mem leaks

#

for example

astral sentinel
#

Is he asking if the change by attributechangedsignal stays?

sturdy charm
#

If you shake the dice 10 times, you will have 10 separate connections all listening to the cup at the same time

#

soo use

#

:Once()

#

so use this snippet instead

#

did that help ? 😄

noble patrol
#

cool tyvm, i assume this only handles a possible memory leak but if the soundEvent ends before this, sound:Stop() still wont happen right?

sturdy charm
#

actually it will still happen

noble patrol
#

nice ill give it a go

sturdy charm
#

alright

noble patrol
#

ah sound:Stop() still doesn't happen (Shaking changes a bit after this connection is made) but :Once is very good to know, ty

sturdy charm
#

otherwise, u can send out the full code and i can see what i can do?

kindred mountain
#

try making a seperate folder for events if you want to

#

in rpstorage

noble patrol
#

nah its fine i know how to make this work, was just hoping i wouldnt have to write more lines for it