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

How to turn off music, when you touch a brick?

Asked by 6 years ago

I'm trying to make a game, and I want to turn off the music when you hit a brick. Can any of you answer this?

1 answer

Log in to vote
0
Answered by
Leamir 3138 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

Hello, TheEliteYoutuber0241!

To detect if something hits a object you use .Touched

Example:

-- Object that will detect will be script's parent --
script.Parent.Touched:Connect(function(hit) -- The hit will give the part that collided name
    -- Do things here --
end)

To stop a music, you can use :Stop()

Example:

-- The music part(what emits the music) is script's parent --
script.Parent:Stop()

This isn't a request website, so I can't give you the full script, but this may help you lots =D

Good Luck with your games!

Ad

Answer this question