Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why doesn't this stop?

It should stop the song, but it doesn't?

--

local sound = game.Workspace.Part
local enable = true
local sound2 = game.Workspace.Part.Sound

--



function Clicked()
	if not enable then return end
	enable = false
	sound.Sound:Play()
	wait(sound.Sound.TimeLength)
	sound.Sound:Stop()
	enable = true
	

if sound.Sound2.IsPlaying == true then
		sound.Sound:Pause()
		end
	
end
script.Parent.MouseButton1Click:connect(Clicked)


7 comments

0

Try removing the sound,Then to re-play re add it in.

0

I'm quiet new to scripting, I don't really understand what you mean.

0

Is this script inside a Gui, or an Object? If it's in an object does it have a ClickDetector in it?

1

using the "if" on line 20, only works once.

0

It is in the text button.

0

Couldn't you just set the sound to not repeat in the sound properties?

0

Looping doesn't have to do with this, if you do understand what I mean here is a desc of it : When a player clicks a song and that song plays NO other songs can play until that song is done.

1 answer

You need a ClickDetector inside the brick.

2 comments

1

How is that even relevant?

0

It's a text button...

This discussion is preserved as it was. New answers, comments, and votes are closed.