****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:
01 | local music = ( "3180460921" , "2590490779" ) |
02 | local sound = script.Parent.Sound |
03 | local muted = false |
04 |
05 | while true do |
06 |
07 | for i = 1 , #music do |
08 | sound.SoundId = "rbxassetid://" ..music [ i ] |
09 | wait( 3 ) |
10 | sound:Play() |
11 | wait(sound.TimeLength) |
12 | end |
13 |
14 |
15 |
16 | end |
And in TheMuter script the error is: Players.snipperdiaper.PlayerGui.MusicSystem.TextButton.TheMuter:4: Expected '(', '{' or <string>, got ':'
The error is located on the 3rd line ( The (:)) between the Click and Connect
And the script is:
01 | local sound = script.Parent.Parent.Sound |
02 | local muted = false |
03 |
04 | script.Parent:MouseButton 1 Click:connect( function () |
05 | if muted then |
06 | sound.Volume = 0.3 |
07 | muted = false |
08 | script.Parent.Text = "Mute" |
09 | else |
10 | sound.Volume = 0 |
11 | muted = true |
12 | script.Parent.Text = "Unmute" |
13 | end |
14 |
15 |
16 | end ) |
thanks, snips
01 | local sound = script.Parent.Parent.Sound |
02 | local muted = false |
03 |
04 | script.Parent:MouseButton 1 Click:connect( function () |
05 | if muted then |
06 | sound.Volume = 0.3 |
07 | muted = false |
08 | script.Parent.Text = "Mute" |
09 | else |
10 | sound.Volume = 0 |
11 | muted = true |
12 | script.Parent.Text = "Unmute" |
13 | end |
14 |
15 |
16 | 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.
You are using the wrong syntax for tables. Replace all (
s and )
s on line 1 to {
s and }
s.