Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited 4 years ago

****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:

01local music = ("3180460921" , "2590490779")
02local sound = script.Parent.Sound
03local muted = false
04 
05while 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 
16end

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:

01local sound = script.Parent.Parent.Sound
02local muted = false
03 
04script.Parent:MouseButton1Click: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 
16end)

thanks, snips

0
The musicPlayer script has been fixed! now we need to figure out TheMuter snipperdiaper 120 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago
01local sound = script.Parent.Parent.Sound
02local muted = false
03 
04script.Parent:MouseButton1Click: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 
16end)

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.

Ad
Log in to vote
1
Answered by
DesertusX 435 Moderation Voter
4 years ago
Edited 4 years ago

You are using the wrong syntax for tables. Replace all (s and )s on line 1 to {s and }s.

0
Any idea on how to fix the: Players.snipperdiaper.PlayerGui.MusicSystem.TextButton.TheMuter:4: Expected '(', '{' or <string>, got ':' snipperdiaper 120 — 4y
0
script.Parent.MouseButton1Click:Connect(fucntion() Friskyman321 121 — 4y

Answer this question