I would like to make sure that a music does not play twice in a row

I would like to make sure that a music does not play twice in a row

I don’t know how to make that

image

local OLDMTP = 2
local MTP = 1

while wait(1) do
	if script.Parent.Played.IsPaused == true then
		wait()
		MTP = math.random(1,16)
		script.Parent.Played.SoundId = script.Parent:WaitForChild("Chill"..MTP).SoundId
		wait(.5)
		script.Parent.Played:Play()
		wait(script.Parent:WaitForChild("Chill"..MTP).TimeLength or 0)
		end
end

If you wonder what MTP means , it means “Music To Play”.

Either move the each piece music to a new folder when it is done playing. And when there are no more options, add them all back in. It to this right, I would make a new variable that gets all the music, then, make it

local MTP = math.random(1, #thefolderchildrenvariable)

Choose from the new number of options.

And then when calling it just do waitforchild(MTP)
And leave out the “chill”

1 Like