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

Adding Music Stop, and Music Play?

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

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()

2 comments

0

still dont play it.

0

you capitalized the S in "script"

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


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