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

Attempting to create a Day/Night music cycle that stops on commands. Not sure where to continue?

Asked by 6 years ago

Hello. After many attempts and lack of motivation almost, I have nearly given up on the day and night music transitions that stop whenever a script tells it to. I have been stuck with this for a while now and I was hoping one of you guys could help fix it up.

Code is stated as below:

--creep

l = game:GetService("Lighting")

--[[function dayAndNight()
    while true do
        l:SetMinutesAfterMidnight(l:GetMinutesAfterMidnight() + 1)  
        wait(0.25)
    end
end
dayAndNight()]]--

function dayNightMusicPlayer()
    if l:GetMinutesAfterMidnight() >= 6 * 6 then
        script.Night:Stop()
            script.transition:Play()
            repeat
                script.Day:Resume()
                    wait()
                        until l:GetMinutesAfterMidnight() < 6 * 6
    elseif l:GetMinutesAfterMidnight() >= 6 * 18 then

            script.Day:Stop()
                script.transition:Play()
                repeat
                    script.Night:Resume()
                        wait()
        until l:GetMinutesAfterMidnight() < 6 * 18
    else
        wait()
    end
end

dayNightMusicPlayer()

I haven't included the stop command yet, because I would at least get around to finishing the music player first. I also have the day and night cycle commented out because it would never get to the day night music player. I am going to move that to another script. Whomever can solve this problem I thank you from the bottom of my heart.

aspiring Roblox Developer -

Creep'

Answer this question