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

How to make a !music command?

--[ 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

im in a bad mood so i will explain it fast: basically just do !music 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)

2 comments

0

I cant really understand

0

ok get help from internet

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