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

Why will this one work but the other not?

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.

2 comments

0

What is RoundTag, and what will change it? When does it get changed?

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

1 answer

✓ Accepted answer

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

1 comment

0

Did it and it stopped at line 7

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