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

How can I stop looped music with a different brick from the brick thats playing music by touch?

Asked by 9 years ago

Please help me I'm trying to make a game where you go in a teleporter and when you enter the teleporter the song stops ( the song starts at spawn) so that's why I really want it to be a different brick so then that if they go in a teleporter they wont have to listen to the same song and I know you can do wait() but I cant predict how long it will take a player to get to the next stage so if someone could help me I would be very thankful :D

2 answers

Log in to vote
0
Answered by 9 years ago

You can do that easily, just find the location of your song and do :stop()

script.Parent.Parent.BrickPlayingSong.SoundName:Stop()

[EDIT] here is a more detailed example script

-- this script is inside the same brick as the song
function onTouched()
script.Parent.DjDubstep:Stop() -- the song being stopped
end

script.Parent.Parent.JailButton.Touched:connect(onTouched) --This is the block on the other side of the house! This is not limited to the brick the script is in, but any brick that can be touched!

If this helped you please accept!

0
So does that mean I do Workspace.(NAMEOFCHILDHERE).(NAMEOFCHILDHERE)? supamaster888 28 — 9y
0
Yeah, exactly yogipanda123 120 — 9y
0
I tried that but it isnt workign still D: because I want to have so when I touch a different block the music coming from a different brick stops supamaster888 28 — 9y
0
I guess ill have to wait for another answer :( thanks anyway though supamaster888 28 — 9y
View all comments (7 more)
0
if you put the script in your question, i will look at it yogipanda123 120 — 9y
0
I gave another example for you SUPA yogipanda123 120 — 9y
0
ok thanks supamaster888 28 — 9y
0
Yeah but I need to be able to touch a different block to make the other block that has music in it stop supamaster888 28 — 9y
0
Yogi or someone can you just give me a script that when I touch a brick the other brick that has music in it stops? supamaster888 28 — 9y
0
SUPA, the script I gave you would work for what you need, you just don't understand... On line 3 is the block with the music ok?... On line 6 is the line with the other brick, it checks if (in this case JailButton) the block is touched! the block is not limited to the block the script is in! I hope this helped! yogipanda123 120 — 9y
0
so yogi does that mean I need to name the block that i want to stop it by touching it is called jailbutton and djdubstep is the audio holding the soundid or is it the music block holding the audio supamaster888 28 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

so yogi does that mean I need to name the block that i want to stop it by touching it is called jailbutton and djdubstep is the audio holding the soundid or is it the music block holding the audio

Answer this question