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

Day and Night Script with a mute button?

Asked by 5 years ago

! 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.

0
is **MusicScript** a local script or a server script? Austinn_K 31 — 5y
0
local robloxquestionnaire1 30 — 5y
0
Music Script is a regular script on the workspace, mute script is a local script in a button robloxquestionnaire1 30 — 5y

Answer this question