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

How would I be able to make this script stop properly?

Asked by 10 years ago

So the script below is in a bool value that is in a textlabel. When the value is true I want the position of the textlabel to slide to the middle and countdown. When the value is false I want it to automatically stop where ever it is and slide back up and make everything else stop too including the countdown and the sound. But it when it's true and changes to false the code in the true statement thingy continues and doesn't stop. Can someone help me out???

script.Parent.Changed:connect(function()
    if script.Parent.Value == true then
        script.Parent.Sound:Stop()
        local r = BrickColor.new("White")
        script.Parent.Parent.Text = "5"
        script.Parent.Parent.TextColor3 = r.Color
        script.Parent.Parent.Position = UDim2.new(0,0,0,-50)
script.Parent.Parent.Visible = true
script.Parent.Sound:Play()
script.Parent.Parent:TweenPosition(UDim2.new(0, 0, 0.5, 0),"Out", "Quad", 3, false)
wait(1.2)
script.Parent.Sound:Play()
script.Parent.Parent.Text = "4"
script.Parent.Parent.TextColor3 = r.Color
wait(1.2)
script.Parent.Sound:Play()
local h = BrickColor.new("New Yeller")
script.Parent.Parent.Text = "3"
script.Parent.Parent.TextColor3 = h.Color
wait(1.2)
script.Parent.Sound:Play()
script.Parent.Parent.Text = "2"
script.Parent.Parent.TextColor3 = h.Color
wait(1.2)
script.Parent.Sound:Play()
local f = BrickColor.new("Lime green")
script.Parent.Parent.Text = "1"
script.Parent.Parent.TextColor3 = h.Color
wait(1.2)
script.Parent.Sound:Play()
script.Parent.Parent.Text = "Begin!"
script.Parent.Parent.TextColor3 = f.Color
wait(1.5)
script.Parent.Value = false
    elseif script.Parent.Value == false then
        script.Parent.Sound:Stop()
        script.Parent.Parent:TweenPosition(UDim2.new(0, 0, 0, -50),"Out", "Quad", 3, true)
        wait(1.5)
        script.Parent.Parent.Visible = false
    end
    end)

1 answer

Log in to vote
-1
Answered by 10 years ago

I suggest cutting this into a script inside this one, then adding a value in the new script. Then, in the new script's if, add a thing where it changes the value of the value in the new script, then adding an if statement into the old script that when the value equals what the new script set, it disables the new script.

Ad

Answer this question