How to detect if a sound is playing

hello.
i have been trying to make a thing like this :

if sound from a part is deteced do:
(the thing i want to happen)
end

like this

can anyone help?
please note that i know nothing about scripting expect the print hello world one

If you specify what the “Thing I want to happen” is maybe lol

local Sound = workspace.Part.Sound
if Sound.IsPlaying then
    print("Sound is playing!")
end

Is this something like what you’re wanting to happen?

1 Like

Hello!

Personally, I’d use the Sound.Played() event for this. This article should be helpful, here’s some sample script for you:

Sound.Played:Connect(function()
— script here
end)

Hope this is of use to you.

6 Likes

thank you! i found the thing in the article! thank you very much sir!