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

Adding Music Stop, and Music Play?

Asked by
22To 70
8 years ago

This script is in server script service,((THIS IS ONLY HALF OF THE SCRIPT)) So i added Script.Parent.Music:Play and Script.Parent.Music:Stop Wont work any help?

function CountDown()
    wait(5)
    for i,v in pairs(game.Players:GetChildren()) do
        coroutine.resume(coroutine.create(function()
            local Time = 30
            local Hint = GuiModule.IntermissionHint(v,"There will now be a brief intermission..")
            wait(1)
            Script.Parent.Music:Play
            while Time > 0 do
                Time = Time - 1
                Hint.TextLabel.Text = "Intermission: "..Time
                wait(1)
            end
            Hint.TextLabel.Text = "Starting game.."
            Script.Parent.Music:Stop
            GuiModule.RetractIntermissionHint(Hint)
        end))
    end
    wait(30)
end

2 answers

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
8 years ago

You aren't calling those methods, you're only sort of indexing them. If you looked at the output, you would see it cursing you.

:Play should be :Play() and :Stop should be :Stop()

0
still dont play it. 22To 70 — 8y
0
you capitalized the S in "script" 1waffle1 2908 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

1waffle is correct. If you are too lazy to add the parenthesis to your code, here you do :P

function CountDown()
    wait(5)
    for i,v in pairs(game.Players:GetChildren()) do
        coroutine.resume(coroutine.create(function()
            local Time = 30
            local Hint = GuiModule.IntermissionHint(v,"There will now be a brief intermission..")
            wait(1)
            Script.Parent.Music:Play()
            while Time > 0 do
                Time = Time - 1
                Hint.TextLabel.Text = "Intermission: "..Time
                wait(1)
            end
            Hint.TextLabel.Text = "Starting game.."
            Script.Parent.Music:Stop()
            GuiModule.RetractIntermissionHint(Hint)
        end))
    end
    wait(30)
end


Answer this question