Sooo I am making a game where you press "p" it starts playing the box "Music" so how do I check if the music is on and if it is press "p" again to turn it off
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.P then -- The Music player
end
end)

2 comments
Don't forget about gameProcessedEvent on InputBegan
Your script worked the best !!