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

I cannot stop sounds in my game. How would I go about this?

Asked by 5 years ago

Ok so I have a sound block that plays music for an area of my game. I need it to stop when you enter the next area I tried scripting a block that stops all sounds and then it goes to the other sound brick and plays the music for that area. But the block thats stops the sound isn't working. I need to stop all the sounds.How would I go about this?


b = script.Parent t = script.Parent.Sound

function onTouch()

t:stop()

end

b.Touched:connect(onTouch)


1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

You need to capitalize the word stop to fire the actual event

The code should look like this:

local b = script.Parent
local t = script.Parent.Sound

b.Touched:Connect(function()
    t:Stop()
end)
0
It didnt work Tetris_Blox 4 — 5y
0
@Tetris, make sure that the script.Parent is something that is somewhere in the workspace. Both "t" and the script need to be parented by the same object SerpentineKing 3885 — 5y
0
:Stop() does not exist, use :Pause() vergelrady 0 — 5y
Ad

Answer this question