Here is the script for dayandnight music
I am trying to mute the dayandnight music but my code isn't working.
My code for the DayAndNightMusic is It is called MusicScript This script WORKS
local d = game.Workspace.DayAndNightMusic.Day
local n = game.Workspace.DayAndNightMusic.Night
while true do
wait(0.1)
if game.Lighting:GetMinutesAfterMidnight() > 6 * 60 then -- @ 6:00 AM
d:play()
n:stop()
wait(9)
end
if game.Lighting:GetMinutesAfterMidnight() > 18 * 60 then -- @ 6:00 PM
n:play()
d:stop()
wait(12)
end
end
The mute button script is a localscript that is located in the started gui. Does NOT work.
local enabled = true
script.Parent.Visible = true
function onClick()
if enabled == false then
game.Workspace.DayAndNightMusic.Day.Enabled = false or game.Workspace.DayAndNightMusic.Night.Enabled
enabled = true
script.Parent.Text = "Music: ON"
else
game.Workspace.DayAndNightMusic.Day.Enabled = false or game.Workspace.DayAndNightMusic.Night.Enabled
enabled = false
script.Parent.Text = "Music: Off"
end
end
script.Parent.MouseButton1Click:connect(onClick)
My mute script is ignored. I did use a script for a 1 song practice game but with 2 songs, nothing is muting.
Thanks in advance.

3 comments
is MusicScript a local script or a server script?
local
Music Script is a regular script on the workspace, mute script is a local script in a button