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

How can I skip a song when I say "skip" in chat?

I have this music player I personally like mostly because of the reason I have audios under the script and the script plays the audios and doesn't copy the id like other music players I've seen because I have to set their playback speed because of copyright and i want that specific playback speed when played in game. But I wanna make it so it skips a song and goes onto the next one when the owner chats "skip". I don't know much about scripting sorry. I want it just how it is but I want to say "skip" for the owner to go onto the next song.

while true do
	script:WaitForChild("Currently Playing: blue jeans"):Play()
	script.Parent.Text = script:WaitForChild("Currently Playing: blue jeans").Name
	wait(155)
	script:WaitForChild("loading..."):Play()
	script.Parent.Text = script:WaitForChild("loading...").Name
	wait(3)
		script:WaitForChild("Currently Playing: needy"):Play()
	script.Parent.Text = script:WaitForChild("Currently Playing: needy").Name
	wait(153)
	script:WaitForChild("loading..."):Play()
	script.Parent.Text = script:WaitForChild("loading...").Name
	wait(3)
		script:WaitForChild("Currently Playing: no time to die"):Play()
	script.Parent.Text = script:WaitForChild("Currently Playing: no time to die").Name
	wait(246)
	script:WaitForChild("loading..."):Play()
	script.Parent.Text = script:WaitForChild("loading...").Name
	wait(3)
		script:WaitForChild("Currently Playing: falling down"):Play()
	script.Parent.Text = script:WaitForChild("Currently Playing: falling down").Name
	wait(200)
	script:WaitForChild("loading..."):Play()
	script.Parent.Text = script:WaitForChild("loading...").Name
	wait(3)
		script:WaitForChild("Currently Playing: everything i wanted"):Play()
	script.Parent.Text = script:WaitForChild("Currently Playing: everything i wanted").Name
	wait(240)
	script:WaitForChild("loading..."):Play()
	script.Parent.Text = script:WaitForChild("loading...").Name
	wait(3)
		script:WaitForChild("Currently Playing: amor de siempre"):Play()
	script.Parent.Text = script:WaitForChild("Currently Playing: amor de siempre").Name
	wait(314)
	script:WaitForChild("loading..."):Play()
	script.Parent.Text = script:WaitForChild("loading...").Name
	wait(3)
		script:WaitForChild("Currently Playing: worldstar money interlude"):Play()
	script.Parent.Text = script:WaitForChild("Currently Playing: worldstar money interlude").Name
	wait(112)
	script:WaitForChild("loading..."):Play()
	script.Parent.Text = script:WaitForChild("loading...").Name
	wait(3)
		script:WaitForChild("Currently Playing: say so"):Play()
	script.Parent.Text = script:WaitForChild("Currently Playing: say so").Name
	wait(110)
	script:WaitForChild("loading..."):Play()
	script.Parent.Text = script:WaitForChild("loading...").Name
	wait(3)
	    script:WaitForChild("Currently Playing: run"):Play()
	script.Parent.Text = script:WaitForChild("Currently Playing: run").Name
	wait(205)
	script:WaitForChild("loading..."):Play()
	script.Parent.Text = script:WaitForChild("loading...").Name
	wait(3)
	    script:WaitForChild("Currently Playing: doin' time"):Play()
	script.Parent.Text = script:WaitForChild("Currently Playing: doin' time").Name
	wait(270)
	script:WaitForChild("loading..."):Play()
	script.Parent.Text = script:WaitForChild("loading...").Name
	wait(3)
	    script:WaitForChild("Currently Playing: cyber sx"):Play()
	script.Parent.Text = script:WaitForChild("Currently Playing: cyber sx").Name
	wait(86)
	script:WaitForChild("loading..."):Play()
	script.Parent.Text = script:WaitForChild("loading...").Name
	wait(3)
	    script:WaitForChild("Currently Playing: girl how will i love you"):Play()
	script.Parent.Text = script:WaitForChild("Currently Playing: girl how will i love you").Name
	wait(100)
	script:WaitForChild("loading..."):Play()
	script.Parent.Text = script:WaitForChild("loading...").Name
	wait(3)
	    script:WaitForChild("Currently Playing: bad vibes forever"):Play()
	script.Parent.Text = script:WaitForChild("Currently Playing: bad vibes forever").Name
	wait(150)
	script:WaitForChild("loading..."):Play()
	script.Parent.Text = script:WaitForChild("loading...").Name
	wait(3)
end

1 answer

By using the function Chatted we can find a player who has typed a specific word like skip ALso you can change some things to suit your preference. Your script.


function onChatted(msg, speaker)
    local source = string.lower(speaker.Name)
    msg = string.lower(msg)
    if msg == "skip"  then
        if Sound then
            Sound.TimePosition = Sound.TimeLength
            end
        end
    end
end
game.Players.PlayerAdded:Connect(function(player) 
    player.Chatted:connect(function(msg) onChatted(msg, player) 
end)
end)

1 comment

0

where would i insert this into? how can i make it merge with my script

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