What I planned for this script to do is run the flag function when a value is changed. In the flag function, the value number has 1 added or subtracted depending on different circumstances. If the value number has not reached the point clarified in the script, it should wait one second and run the function again. Every part of this works other than the wait part. It seems as if there is no wait between the running of flag. Nothing appears in the output and from what I know of scripting (even if I don't know much) this should work.
number = 0
function update()
if number == -13 then
script.Parent.flag.CFrame = CFrame.new(126.961, 390.416, -419.518)
elseif number == -12 then
script.Parent.flag.CFrame = CFrame.new(126.961, 389.416, -419.518)
elseif number == -11 then
script.Parent.flag.CFrame = CFrame.new(126.961, 388.416, -419.518)
elseif number == -10 then
script.Parent.flag.CFrame = CFrame.new(126.961, 387.416, -419.518)
elseif number == -9 then
script.Parent.flag.CFrame = CFrame.new(126.961, 386.416, -419.518)
elseif number == -8 then
script.Parent.flag.CFrame = CFrame.new(126.961, 385.416, -419.518)
elseif number == -7 then
script.Parent.flag.CFrame = CFrame.new(126.961, 384.416, -419.518)
elseif number == -6 then
script.Parent.flag.CFrame = CFrame.new(126.961, 383.416, -419.518)
elseif number == -5 then
script.Parent.flag.CFrame = CFrame.new(126.961, 382.416, -419.518)
elseif number == -4 then
script.Parent.flag.CFrame = CFrame.new(126.961, 381.416, -419.518)
elseif number == -3 then
script.Parent.flag.CFrame = CFrame.new(126.961, 380.416, -419.518)
elseif number == -2 then
script.Parent.flag.CFrame = CFrame.new(126.961, 379.416, -419.518)
elseif number == -1 then
script.Parent.flag.CFrame = CFrame.new(126.961, 378.416, -419.518)
elseif number == 0 then
script.Parent.flag.CFrame = CFrame.new(126.961, 377.416, -419.518)
elseif number == 1 then
script.Parent.flag.CFrame = CFrame.new(126.961, 378.416, -419.518)
elseif number == 2 then
script.Parent.flag.CFrame = CFrame.new(126.961, 379.416, -419.518)
elseif number == 3 then
script.Parent.flag.CFrame = CFrame.new(126.961, 380.416, -419.518)
elseif number == 4 then
script.Parent.flag.CFrame = CFrame.new(126.961, 381.416, -419.518)
elseif number == 5 then
script.Parent.flag.CFrame = CFrame.new(126.961, 382.416, -419.518)
elseif number == 6 then
script.Parent.flag.CFrame = CFrame.new(126.961, 383.416, -419.518)
elseif number == 7 then
script.Parent.flag.CFrame = CFrame.new(126.961, 384.416, -419.518)
elseif number == 8 then
script.Parent.flag.CFrame = CFrame.new(126.961, 385.416, -419.518)
elseif number == 9 then
script.Parent.flag.CFrame = CFrame.new(126.961, 386.416, -419.518)
elseif number == 10 then
script.Parent.flag.CFrame = CFrame.new(126.961, 387.416, -419.518)
elseif number == 11 then
script.Parent.flag.CFrame = CFrame.new(126.961, 388.416, -419.518)
elseif number == 12 then
script.Parent.flag.CFrame = CFrame.new(126.961, 389.416, -419.518)
elseif number == 13 then
script.Parent.flag.CFrame = CFrame.new(126.961, 390.416, -419.518)
end
end
function flag()
if script.Parent.teamtaking.Value == "R" then
if number == 0 then
script.Parent.flag.BrickColor = BrickColor.new("Bright red")
script.Parent.pole.BillboardGui.tag.BackgroundColor3 = Color3.new(1,0.137254902,0.137254902)
end
number = number + 1
update()
for _,player in pairs (script.Parent.rplayers:GetChildren()) do
if player then
plr = game.Players:GetPlayerFromCharacter(player.Value)
plr.playerpointstore.Value = plr.playerpointstore.Value + 10
end
end
if number == 13 then
script.Parent.team.Value = "R"
else
wait(1)
flag()
end
elseif script.Parent.teamtaking.Value == "B" and number ~= -13 then
if number == 0 then
script.Parent.flag.BrickColor = BrickColor.new("Bright blue")
script.Parent.pole.BillboardGui.tag.BackgroundColor3 = Color3.new(0.137254902,0.137254902,1)
end
number = number - 1
update()
for _,player in pairs (script.Parent.bplayers:GetChildren()) do
if player then
plr = game.Players:GetPlayerFromCharacter(player.Value)
plr.playerpointstore.Value = plr.playerpointstore.Value + 10
end
end
if number == -13 then
script.Parent.team.Value = "B"
else
wait(1)
flag()
end
elseif script.Parent.teamtaking.Value == "N" and script.Parent.team.Value == "R" and number ~= 13 then
script.Parent.team.Value = "R"
number = number + 1
update()
if number ~= 13 then
wait(1)
flag()
end
elseif script.Parent.teamtaking.Value == "N" and script.Parent.team.Value == "B" and number ~= -13 then
script.Parent.team.Value = "B"
number = number - 1
update()
if number ~= -13 then
wait(1)
flag()
end
elseif script.Parent.teamtaking.Value == "N" and script.Parent.team.Value == "N" and number < 0 then
script.Parent.team.Value = "N"
number = number + 1
update()
if number == 0 then
script.Parent.flag.BrickColor = BrickColor.new("Institutional white")
script.Parent.pole.BillboardGui.tag.BackgroundColor3 = Color3.new(1,1,1)
else
wait(1)
flag()
end
elseif script.Parent.teamtaking.Value == "N" and script.Parent.team.Value == "N" and number > 0 then
script.Parent.team.Value = "N"
number = number - 1
update()
if number == 0 then
script.Parent.flag.BrickColor = BrickColor.new("Institutional white")
script.Parent.pole.BillboardGui.tag.BackgroundColor3 = Color3.new(1,1,1)
else
wait(1)
flag()
end
end
end
script.Parent.teamtaking.Changed:connect(function()
flag()
end)

4 comments
Did you print debug it to make sure it's the wait and not anything else?
It seems to be completely fine. There should be a closed parenthesis after the end at the bottom. It doesn't make a difference though.
jesus that's so many
elseifs, you should use a dictionaryDoes anyone think they have an answer to my question?