#Music

1 messages · Page 1 of 1 (latest)

orchid osprey
#

I made a script where when the player clicks on the button, music starts playing. If he presses the Stop button, the music will stop playing. But the next time the player turns on the music, he has to wait for a while and only then it turns on. Do you know how to fix it?

#

help plzz

lucid kayak
#

Make a bool variable that flips on and off every time the user clicks the button

#

Then check if the variable is false, play the audio

#

And vice versa

orchid osprey
#

pls

agile magnet
#

If u don't know how this works then u should be learning the basics

sudden swan
#

Since they are both connections they dont need to be nested

agile magnet
sudden swan
#

He needs direction

#

So direct him accordingly

#

Otherwise ur just insulting them just to insult them

#

And that accomplishes nothing lmao

agile magnet
sudden swan
#

It seems like he understands what a boolean is from his script

#

His issue is in callbacks and connections

agile magnet
sudden swan
#

Just anywhere outside the other function

#

Because that's his main problem

agile magnet
lucid kayak
sudden swan
#

They are 2 seperate connected instances

#

It isn't the same button in each connection

sudden swan
#

Lol

agile magnet
lucid kayak
#

Mb

agile magnet
#

?

#

Yeah then make it a diff function

lucid kayak
#

3 s1 gang

sudden swan
#

xD

agile magnet
#

💀

sudden swan
#

But yeah do a seperate function and the better logical stuff can come later

agile magnet
#

Yeah would help with the nesting too

sudden swan
#

Well he needs like 0 nesting really

#

Because if ur establishing a callback when one button is clicked then it is gonna do something funky

lunar orbit
sudden swan
orchid osprey
orchid osprey
sudden swan
#

But it would be smart to try to minimize rewritten code and maybe adding a debounce

orchid osprey