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 3 years ago
Edited 3 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:

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 <string>, 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

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

2 answers

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago
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.

Ad
Log in to vote
1
Answered by
DesertusX 435 Moderation Voter
3 years ago
Edited 3 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 — 3y
0
script.Parent.MouseButton1Click:Connect(fucntion() Friskyman321 121 — 3y

Answer this question