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

Having trouble with a music change/toggle script?

Here is the code I have, I don't know why it isn't working.

Brick = script.Parent
ch1 = Brick.Channel_1
ch2 = Brick.Channel_2

function onClicked()
	if Brick.On.Value == false then
		Brick.On.Value = true
	elseif Brick.On.Value == true then
		Brick.On.Value = false
		if script.Parent.Channel.Value == "ch1" and Brick.On.Value == true then
			Brick.Channel_1:Play()
		elseif script.Parent.Channel.Value == "ch2" and Brick.On.Value == true then
			Brick.Channel_2:Play()
		else
			Brick.Channel_1:Stop()
			Brick.Channel_2:Stop()
		end
	end
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

1 answer

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