Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.