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

Math glitch? Strobe light won't blink when supposed to sometimes..

Asked by
4D_X 118
6 years ago

So I'm working on a project, and it involved a ton of strobe lights at certain parts of the music. I made it so when the music hits that part or goes above the part a little, the strobe light blinks. It works good, but when the strobes are going crazy and all that, the strobe won't blink even though the time is over the needed time. This is what it does.

Waiting... 34.606635874356| need 9.3627754284025

34 is what the music is at, 9 is when the strobe is supposed to blink. No errors, no warnings, etc. Here is the script that handles the strobe

function START()
    if doing == false then
        doing = true
        bck.STRT.BackgroundTransparency = 0.5
        game.Lighting.TimeOfDay = "00:00:00"
        game.Lighting.GlobalShadows = false
        workspace.MUSIC.SoundId = bck.MUSIC.SoundId
        workspace.MUSIC:Play()
        local AM = 0
        print('Set AM First Val')
        for i,v in pairs(bck.STORAGE:GetChildren()) do
            AM = AM + 1
        end
        print(AM.. 'is how mcuh ok')
        for i = 1,AM,1 do
        repeat wait() local kl = ''.. workspace.MUSIC.TimePosition print('Waiting... '.. kl .. "| need ".. bck.STORAGE[i].Value)
            local ko = bck.STORAGE[i].Value
        until kl >= ko or kl == ko
            if bck.STORAGE[i].Type.Value == "Strobe" then
                Strobe()
                print('Strobe')
            elseif bck.STORAGE[i].Type.Value == "BottomStrobe" then
                BottomStrobe()
                print('BottomStrobe')
            elseif bck.STORAGE[i].Type.Value == "Wave" then
                Wave()
                print('DA WAVE')
            elseif bck.STORAGE[i].Type.Value == "Color1" then
                Color('ALL', bck.Color.Color1.Text)
            elseif bck.STORAGE[i].Type.Value == "Color2" then
                Color('ALL', bck.Color.Color2.Text)
            end
            print('Did strobe')
        end
        print('Done')
        workspace.MUSIC:Stop()
        doing = false
        bck.STRT.BackgroundTransparency = 0
        game.Lighting.TimeOfDay = "05:00:00"
        game.Lighting.GlobalShadows = true
    end
end

Help please!!

Answer this question