Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why won't my sounds remove itself? Why does it loop again?

Asked by 5 years ago

I have a sound that get played for my intro. Everything works fine except the end. I have it where at the end of the intro, it would remove the screengui and all the children that is along with it. It seems normal but it's not because instead of removing itself, it plays the song over again. This is my code:

local bells = bg.bells --the sound

bells:Play()

wait(5)

bg.bells.Volume = 0 --I added these to make the songs stop making sound but it does not work
bg.haunting.Volume = 0

game:GetService("StarterGui").Intro:Remove() --Trying to remove my intro along with all the children with it

I don't know how to make it stop. Should I just use a different method or not use sounds at all?

0
intro as in a loading screen? User#5423 17 — 5y
0
Not so much as a loading screen. It's pretty much just the title of my game along with credits before it fades out. skate992 57 — 5y
0
It sounds a lot like a load screen. You can replace the def one made by Roblox which might be what you want. User#5423 17 — 5y
0
How would I do that? skate992 57 — 5y
View all comments (3 more)
0
Your current script is accessing the StarterGui and not the players gui. Also use Destroy not Remove. User#5423 17 — 5y
0
Lol, I said the exact same thing greenhamster1 180 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Ok, so first of all you should reference "intro" earlier making sure it is the correct one. Then you should write the code when you want to stop the sound:

bells:Stop()

And make sure that the bells are not on loop. Having them on loop might be your problem. Do the same for the haunting sound. Finally to remove something you have to do the following:

game:GetService("StarterGui").Intro:Destroy()

If it doesn't work comment and I will see what I can do. Hope this helps!

0
Using the :Destroy() method did removing the ScreenGui along with the sound but the sound still plays after it is destroyed. I threw in a bells:Stop() to see if it would work too but it didn't skate992 57 — 5y
0
Hmm, that might be a studio bug. Have the sounds actually been removed? greenhamster1 180 — 5y
0
Yes. Both in the starter gui and the player's gui. I made sure to target them both. skate992 57 — 5y
0
Yeah I think it is a bug. It shouldn't happen. greenhamster1 180 — 5y
0
I tried it on the regular server but still the same problem. I think I should just remove everything else other than the sound skate992 57 — 5y
Ad

Answer this question