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

How to make a !music command?

Asked by 3 years ago
--[ SONG LOCAL ]--

local sound = workspace.Sound

--[ SONG COMMANDS ]--

game.Players.PlayerAdded:Connect(function(Player)
    Player.Chatted:Connect(function(m)
        if Player:IsInGroup(3070754) and Player:GetRankInGroup(3070754) >= 180 then
            print("player chatted")
            if (m:lower() == "!skip") then
                sound.TimePosition = sound.TimeLength
                print("skipped")
            elseif (m:lower() == "!resume") then
                sound:Resume()
                print("resumed")
            elseif (m:lower() == "!pause") then
                sound:Pause()
                print("paused")
            elseif (m:lower() == "!play") then
                sound:Play()
                print("played")
            elseif (m:lower() == "!music") then
                sound.SoundId = "rbxassetid://"
                print("test")
            end
        end
    end)
end)

cant get it to work no error it just doesnt work

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

im in a bad mood so i will explain it fast: basically just do !music <musicid> to change the id also the commands will work even if you do !resume yf92y(extra arguments if its not stated)

--[ SONG LOCAL ]--

local sound = workspace.Sound

--[ SONG COMMANDS ]--

game.Players.PlayerAdded:Connect(function(Player)
    Player.Chatted:Connect(function(m)
        m = m:lower() -- easier lower() and less letters
    m = m:split(" ") making the arguments
        if Player:IsInGroup(3070754) and Player:GetRankInGroup(3070754) >= 180 then
            print("player chatted")
            if m[1] == "!skip" then
                sound.TimePosition = sound.TimeLength
                print("skipped")
            elseif m[1] == "!resume" then
                sound:Resume()
                print("resumed")
            elseif m[1] == "!pause" then
                sound:Pause()
                print("paused")
            elseif m[1] == "!play" then
                sound:Play()
                print("played")
            elseif m[1] == "music" then
                sound.SoundId = "rbxassetid://"..[m2]
                print("test")
            end
        end
    end)
end)
0
I cant really understand Mel_pro1 5 — 3y
0
ok get help from internet BuildAboatTest124 51 — 3y
Ad

Answer this question