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

Music button on/off ability?

-- This script seems correct to me (just starting out) what have I done wrong? Button = script.Parent music = script.Parent.Sound

music = false music = true

function onClick()

if music == false then

	music = true
	music:Play()

elseif music == true then

	music = false
	music:Stop()	
	
	music = true
	music = false

end
	end

Button.ClickDetector.MouseClick:connect(onClick)

2 comments

0

Could you make the entire script in Lua format rather than just the middle of it? I could help you further if it's formatted correctly

0

is there a need for lines 11 and 12

1 answer

Script figured out, by me typing the syntax Sound:Play() , it was thinking I was just simply trying to play an audio without a reference.

Changing the reference from Sound = Brick.Sound, to "Audio = Brick.Sound" did the trick.

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