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

Why will this one work but the other not?

Asked by 9 years ago
while wait() do
    if repstorage.GameRound.Value == "Controller" then
        if flag1.Value == "White" and flag2.Value == "Green" and flag3.Value == "White" then
            greenscore.Value = 1
            yellowscore.Value = 0
        end
    end
end

^ How come the above works

repstorage.RoundTag.Changed:connect(function(value)
    if value == true then
        if repstorage.GameRound.Value == "Controller" then
            if flag1.Value == "White" and flag2.Value == "Green" and flag3.Value == "White" then
                greenscore.Value = 1
                yellowscore.Value = 0
            end
        end
    end
end)

And this one dosent. I would prefer the one with the Changed event over a while true do loop. There are no errors in the whole script. Please help.

0
What is `RoundTag`, and what will change it? When does it get changed? BlueTaslem 18071 — 9y
0
I have this huge main script that changes the RoundTag at a certain time and changes it back, i Put a print after it checks for if (GameRound.Value == "Controller" then) and prints it, so its anything after NinjoOnline 1146 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

Mmm, the first thing I notice is if value == true then on line 02, Maybe change this to if if repstorage.RoundTag.Value == true then. If that doesn't work the after each if statement, place a print. Like so. This can help identify where the problem lies.

repstorage.RoundTag.Changed:connect(function(value)
    print('Changed')
    if repstorage.RoundTag.Value== true then
    print('IsTrue')
        if repstorage.GameRound.Value == "Controller" then
        print('IsController')
             if flag1.Value == "White" and flag2.Value == "Green" and flag3.Value == "White" then
        print('GreenScoreIncreased')
                greenscore.Value = 1
                yellowscore.Value = 0
            end
        end
    end
end)

Hope this helps, Brandon. <3

0
Did it and it stopped at line 7 NinjoOnline 1146 — 9y
Ad

Answer this question