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

Help with a script?

Asked by 10 years ago

Hi,

I have two scripts here that work fine. I press play and it plays but when I stop one and press play on the other button with the other script the music from before starts playing again.

Say; I press script 1 button. Summer comes on, then I click the button again for it to stop and it all stops. Then I press script 2 button and Let it go comes on, then a couple of seconds later Summer or another song in my workspace comes on with let it go!

Please help!

Here are the two scripts.

Script one;

local Clicked = false

function onClick()
    Clicked = not Clicked
script.Parent.BrickColor = BrickColor.new("Really red") -- Same here
    while Clicked do
        script.Parent.Parent.Sound7:Play()
        wait(120)
        script.Parent.Parent.Sound7:Stop()
        wait(.1)
        script.Parent.Parent.Sound1:Play()
        wait(120)
        script.Parent.Parent.Sound1:Stop()
        wait(.1)
        script.Parent.Parent.Sound2:Play()
        wait(120)
        script.Parent.Parent.Sound2:Stop()
        wait(.1)
        script.Parent.Parent.Sound3:Play()
        wait(120)
        script.Parent.Parent.Sound3:Stop()
        wait(.1)
        script.Parent.Parent.Sound4:Play()
        wait(120)
        script.Parent.Parent.Sound4:Stop()
        wait(.1)
        script.Parent.Parent.Sound5:Play()
        wait(120)
        script.Parent.Parent.Sound5:Stop()
        wait(.1)
        script.Parent.Parent.Sound6:Play()
        wait(120)
        script.Parent.Parent.Sound6:Stop()
        wait(.1)
    end

    if not Clicked then
    script.Parent.BrickColor = BrickColor.new("Medium stone grey")
        script.Parent.Parent.Sound1:Stop()
        script.Parent.Parent.Sound2:Stop()
        script.Parent.Parent.Sound3:Stop()
        script.Parent.Parent.Sound4:Stop()
        script.Parent.Parent.Sound5:Stop()
        script.Parent.Parent.Sound6:Stop()
        script.Parent.Parent.Sound7:Stop()
    end
end


script.Parent.ClickDetector.MouseClick:connect(onClick)

Script 2;

local Clicked = false

function onClick()
    Clicked = not Clicked
script.Parent.BrickColor = BrickColor.new("Really red") -- Same here
    while Clicked do
        script.Parent.Parent.Sound6:Play()
        wait(120)
        script.Parent.Parent.Sound6:Stop()
        wait(.1)
        script.Parent.Parent.Sound7:Play()
        wait(120)
        script.Parent.Parent.Sound7:Stop()
        wait(.1)
        script.Parent.Parent.Sound1:Play()
        wait(120)
        script.Parent.Parent.Sound1:Stop()
        wait(.1)
        script.Parent.Parent.Sound2:Play()
        wait(120)
        script.Parent.Parent.Sound2:Stop()
        wait(.1)
        script.Parent.Parent.Sound3:Play()
        wait(120)
        script.Parent.Parent.Sound3:Stop()
        wait(.1)
        script.Parent.Parent.Sound4:Play()
        wait(120)
        script.Parent.Parent.Sound4:Stop()
        wait(.1)
        script.Parent.Parent.Sound5:Play()
        wait(120)
        script.Parent.Parent.Sound5:Stop()
        wait(.1)
    end

    if not Clicked then
    script.Parent.BrickColor = BrickColor.new("Medium stone grey")
        script.Parent.Parent.Sound1:Stop()
        script.Parent.Parent.Sound2:Stop()
        script.Parent.Parent.Sound3:Stop()
        script.Parent.Parent.Sound4:Stop()
        script.Parent.Parent.Sound5:Stop()
        script.Parent.Parent.Sound6:Stop()
script.Parent.Parent.Sound7:Stop()
    end
end


script.Parent.ClickDetector.MouseClick:connect(onClick)



Thanks Kieran

1 answer

Log in to vote
0
Answered by 10 years ago

Hmm,I don't see a single difference between the two,a suggestion which is very basic but may help is to copy the first script and place that in the second button.

The mistake with this script may just be a common error,just look over the scripts again if my suggestion did not help.

0
There is nothing thats the thing. It's just that it is not fully responding the the actual command scipr kieranm9090 49 — 10y
0
script* kieranm9090 49 — 10y
Ad

Answer this question