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

How would I make it so when a certain person says the word skip, it skips the song?

How would I make it so that when like a certain person ("namehere") says "skip song" it skips to the next song? here is my original script

print 'Loading Playlist'
song1 = "http://www.roblox.com/asset/?id=299075527" --ellie goulding on my minf
song2 = "http://www.roblox.com/asset/?id=292433682" -- death of a bachelor p!atd
song3 = "http://www.roblox.com/asset/?id=589851184" --- halleujah
song4 = "http://www.roblox.com/asset/?id=787636293" --- zed stay
song5 = "http://www.roblox.com/asset/?id=666248225" -- something just like this
song6 = "http://www.roblox.com/asset/?id=156850138" --nico and vinz
song7 = "http://www.roblox.com/asset/?id=561274893" --starboy
song8 = "http://www.roblox.com/asset/?id=188712851"--shut up and dance
song9 = "http://www.roblox.com/asset/?id=685388224"--magine dragons believer
song10 = "http://www.roblox.com/asset/?id=882915526"--mad hatter melanie martinez
song11 = "http://www.roblox.com/asset/?id=501405545"--lane boy
song12 = "http://www.roblox.com/asset/?id=610923182"--paris
song13 = "http://www.roblox.com/asset/?id=444240273"--mo final song
song14 = "http://www.roblox.com/asset/?id=181547615"--Centuries
song15 = "http://www.roblox.com/asset/?id=152357361"
song16 = "http://www.roblox.com/asset/?id=145579822"
song17 = "http://www.roblox.com/asset/?id=148492408"
song18 = "http://www.roblox.com/asset/?id=142720946"
song19 = "http://www.roblox.com/asset/?id=142372565"
song20 = "http://www.roblox.com/asset/?id=152779074"
song21 = "http://www.roblox.com/asset/?id=145915908"
song22 = "http://www.roblox.com/asset/?id=138855854"
song23 = "http://www.roblox.com/asset/?id=259802648"
song24 = "http://www.roblox.com/asset/?id=641912399"




print 'Creating a Source of Audio'
local music = Instance.new("Sound") 
music.Archivable = true 
print 'Inspecting the Configurable Variables'



music.Parent = script.Parent 

music.Pitch = 1 
music.Volume = 3 
music.Looped = false
music.Name = "Player"
print 'Loading RMP 1.0'
while (true) do
    print 'Playing Sound 1'
    script.Parent.SurfaceGui.Frame.Visible = true
    script.Parent.SurfaceGui.Frame.Song.Text = ("Ellie Goulding - On My Mind")

music.SoundId = song1 

music:play()
wait(150) 
    --2--
    print 'Playing Sound 2'
    script.Parent.SurfaceGui.Frame.Visible = true
    script.Parent.SurfaceGui.Frame.Song.Text = ("Panic! at the Disco - Death of a Bachelor")

music.SoundId = song2
music:play() 
wait(150)
    --3--
    script.Parent.SurfaceGui.Frame.Visible = true
    script.Parent.SurfaceGui.Frame.Song.Text = ("Pentatonix - Hallelujah")
    print 'Playing Sound 3'
music.SoundId = song3
music:play() 
wait(200)
    --4--
    script.Parent.SurfaceGui.Frame.Visible = true
    script.Parent.SurfaceGui.Frame.Song.Text = ("Zedd and Alessia Cara - Stay")
    print 'Playing Sound 4'
music.SoundId = song4
music:play() 
wait(200)
    --5--
    script.Parent.SurfaceGui.Frame.Visible = true
    script.Parent.SurfaceGui.Frame.Song.Text = ("Coldplay and Chainsmokers - Something Just like this")
        print 'Playing Sound 5'
music.SoundId = song5
music:play() 
wait(200)
    --6--
    script.Parent.SurfaceGui.Frame.Visible = true
    script.Parent.SurfaceGui.Frame.Song.Text = ("Nico and Vinz - Am I Wrong")
    print 'Playing Sound 6'
music.SoundId = song6
music:play() 
wait(200)
    --7--
    script.Parent.SurfaceGui.Frame.Visible = true
    script.Parent.SurfaceGui.Frame.Song.Text = ("Weekend - Starboy")
    print 'Playing Sound 7'
music.SoundId = song7
music:play() 
wait(200)
    --8--
    print 'Playing Sound 8'
    script.Parent.SurfaceGui.Frame.Visible = true
    script.Parent.SurfaceGui.Frame.Song.Text = ("Walk the moon - Shut up and Dance")
music.SoundId = song8
music:play() 
wait(200)
--9--
    print 'Playing Sound 8'
    script.Parent.SurfaceGui.Frame.Visible = true
    script.Parent.SurfaceGui.Frame.Song.Text = ("Imagine Dragons - Believer")
music.SoundId = song9
music:play() 
wait(200)
--10--
    print 'Playing Sound 8'
    script.Parent.SurfaceGui.Frame.Visible = true
    script.Parent.SurfaceGui.Frame.Song.Text = ("Melanie Martinez - Mad Hatter")
music.SoundId = song10
music:play() 

wait(200)
--11--
    print 'Playing Sound 11'
    script.Parent.SurfaceGui.Frame.Visible = true
    script.Parent.SurfaceGui.Frame.Song.Text = ("TwentyonePilots - Lane Boy")
music.SoundId = song11
music:play() 
wait(200)
--11--
    print 'Playing Sound 11'
    script.Parent.SurfaceGui.Frame.Visible = true
    script.Parent.SurfaceGui.Frame.Song.Text = ("Chainsmokers - Paris")
music.SoundId = song12
music:play() 
wait(200)
--11--
    print 'Playing Sound 11'
    script.Parent.SurfaceGui.Frame.Visible = true
    script.Parent.SurfaceGui.Frame.Song.Text = ("MØ - Final Song")
music.SoundId = song13
music:play() 
wait(200)
--11--
    print 'Playing Sound 11'
    script.Parent.SurfaceGui.Frame.Visible = true
    script.Parent.SurfaceGui.Frame.Song.Text = ("Fall out boy - Centuries")
music.SoundId = song14
music:play() 

end


here is a script someone gave me on the same question but it doesnt work well.

local dictonary = {}
dictonary[1] = "http://www.roblox.com/asset/?id=299075527"
dictonary[2] = "http://www.roblox.com/asset/?id=292433682"
dictonary[3] = "http://www.roblox.com/asset/?id=589851184"
dictonary[4] = "http://www.roblox.com/asset/?id=787636293"
dictonary[5] = "http://www.roblox.com/asset/?id=666248225"
dictonary[6] = "http://www.roblox.com/asset/?id=156850138"
dictonary[7] = "http://www.roblox.com/asset/?id=561274893"
dictonary[8] = "http://www.roblox.com/asset/?id=188712851"
dictonary[9] = "http://www.roblox.com/asset/?id=685388224"
dictonary[10] = "http://www.roblox.com/asset/?id=882915526"
dictonary[11] = "http://www.roblox.com/asset/?id=501405545"
dictonary[12] = "http://www.roblox.com/asset/?id=610923182"
dictonary[13] = "http://www.roblox.com/asset/?id=444240273"
dictonary[14] = "http://www.roblox.com/asset/?id=181547615"
dictonary[15] = "http://www.roblox.com/asset/?id=152357361"
dictonary[16] = "http://www.roblox.com/asset/?id=145579822"
dictonary[17] = "http://www.roblox.com/asset/?id=148492408"
dictonary[18] = "http://www.roblox.com/asset/?id=142720946"
dictonary[19] = "http://www.roblox.com/asset/?id=142372565"
dictonary[20] = "http://www.roblox.com/asset/?id=152779074"
dictonary[21] = "http://www.roblox.com/asset/?id=145915908"
dictonary[22] = "http://www.roblox.com/asset/?id=138855854"
dictonary[23] = "http://www.roblox.com/asset/?id=259802648"
dictonary[24] = "http://www.roblox.com/asset/?id=641912399"

print(#dictonary, dictonary[1])
music = Instance.new("Sound", workspace)
music.Pitch = 1
music.Volume = 3
music.Looped = false
music.Name = "Player"
music.SoundId = dictonary[1]
music:Play()

variable = 1
musicwaschanged = false
wait()
while true do
    if variable > 24 then
        variable = 1
    end
    for i = 1, 24 do
        if musicwaschanged == false then
            wait(music.TimeLength - music.TimePosition)
            variable = i
            music:Stop()
            music.SoundId = dictonary[i]
            music:Play()
            print("music changed!")
            print(i)
            print("variable is "..i)
        end
    end
end

game:GetService("Players").PlayerAdded:connect(function(player)
    player.Chatted:connect(function(msg)
        if msg == "skip" then
            musicwaschanged = true
            print(player.." has requested a skip!")
            variable = variable + 1
            for i = variable, 24 do
                music:Stop()
                music.SoundId = dictonary[i]
                music:Play()
            end
        end
    end)
end)

2 comments

1

omy

0

i just got table diarrhea

1 answer

local dictonary = {
299075527,
292433682,
589851184,
787636293,
666248225,
156850138,
561274893,
188712851,
685388224,
882915526,
501405545,
610923182,
444240273,
181547615,
152357361,
145579822,
148492408,
142720946,
142372565,
152779074,
145915908,
138855854,
259802648,
641912399}

local admins = {
	player1 = true;
	azarth = true;
	sweetlittlegirlohhl = true
}

local players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
-- Don't repeat yourself (DRY).
local link = 'http://www.roblox.com/asset/?id='

-- Make your variables local, unless they have to be global
local music = Instance.new("Sound", workspace)
music.Pitch = 1
music.Volume = 3
music.Looped = false
music.Name = "Player"

local track = 1
local last_song

function play_new()
	if last_song then music:Stop() end
	local new_song = link..dictonary[track]
	last_song = new_song
	music.SoundId = new_song
	music:Play()
	-- Go to the next track if we aren't on the last one
	-- if we are, loop back to the first one
	track = ( track + 1 > #dictonary and 1 or track + 1 ) 
end

music.Played:connect(function()
	-- Tells you what song is being played.
	print(MarketplaceService:GetProductInfo(string.match(music.SoundId, "%d+")).Name)
end)

-- Use the ended signal instead of While true do.
music.Ended:connect(function()
	play_new()
end)

local function player_joined(player)
	player.Chatted:Connect(function(msg)
		-- if we said skip and we're in the admin list
        if msg:lower() == "skip" and admins[player.Name:lower()] then
			print(player.Name.." has requested a skip!")
			play_new()
        end
    end)
end

players.PlayerAdded:Connect(function(player)
    player_joined(player)
end)

-- Attaches all the players PlayerAdded didn't
for i,v in pairs(players:GetPlayers()) do 
	player_joined(v)
end

play_new()

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