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

Im making music for my game, but the errors make no sense?

****THE MusicPlayer PROBLEM HAS BEEN FIXED! We only need to find out why TheMuter isnt working!

Any help is really appriciated, please look at all the info I provided before answering

Heres the layout: https://gyazo.com/1b2ca8d2a6a27f52dde9fabe84bace83

In MusicPlayer the error is: Players.snipperdiaper.PlayerGui.MusicSystem.MusicPlayer:1: Expected ')' (to close '(' at column 15), got ','

and the error is on the comma between the two songs. Heres the script:

local music = ("3180460921" , "2590490779")
local sound = script.Parent.Sound
local muted = false

while true do
	
	for i = 1, #music do
	sound.SoundId = "rbxassetid://"..music[i]
		wait(3)
	sound:Play()
	wait(sound.TimeLength)
	end
	
	
	
end

And in TheMuter script the error is: Players.snipperdiaper.PlayerGui.MusicSystem.TextButton.TheMuter:4: Expected '(', '{' or , got ':'

The error is located on the 3rd line ( The (:)) between the Click and Connect

And the script is:

local sound = script.Parent.Parent.Sound
local muted = false

script.Parent:MouseButton1Click:connect(function()
	if muted then
		sound.Volume = 0.3
		muted = false
		script.Parent.Text = "Mute"
	else
			sound.Volume = 0
			muted = true
			script.Parent.Text = "Unmute"
	end
	
	
end)

thanks, snips

1 comment

0

The musicPlayer script has been fixed! now we need to figure out TheMuter

2 answers

✓ Accepted answer
local sound = script.Parent.Parent.Sound
local muted = false

script.Parent:MouseButton1Click:connect(function()
    if muted then
        sound.Volume = 0.3
        muted = false
        script.Parent.Text = "Mute"
    else
            sound.Volume = 0
            muted = true
            script.Parent.Text = "Unmute"
    end


end)

Fix: script.Parent.MouseButton1Click , not script.Parent:MouseButton1Click

Also I noticed that instead of stopping the sound you turned down the volume. In most games, when you mute the music and unmute it, it goes back to where it was before. If you turn down the sound you cannot acheive this behavior. My recommendation is to stop the sound using sound:Stop() and when you want to play it sound:Play().

Anyways, I hope this helped you.

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