HOW TO TURN ON AND OFF MUSIC IS ROBLOX STUDIO? Tutorial

Опубликовано: 22 Сентябрь 2026
на канале: ♥️ItsAli ♥️
43
1

I have edited this description and sorry if you used the other script. The other script still works but the background transparency for the button in the other script was just only white.


Use this script instead:


local SoundService = game:GetService("SoundService")
local music = SoundService:WaitForChild("Calm Music")
local button = script.Parent

-- Track whether the music is muted or not
local isMuted = false

local function onButtonClicked()
if isMuted then
-- Unmute the music
music.Volume = 0.5
button.Text = "Music On"
button.BackgroundColor3 = Color3.fromRGB(58, 255, 14) -- Changes color to GREEN when unmuted
isMuted = false
else
-- Mute the music
music.Volume = 0
button.Text = "Music Off"
button.BackgroundColor3 = Color3.fromRGB(255, 0, 0) -- Changes color to RED when muted
isMuted = true
end
end

-- Listen for the player clicking the button
button.MouseButton1Click:Connect(onButtonClicked)