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

Why does my script print "equal" when it shouldn't do that?

Hello, I have a problem, here is my script:

for i,v in pairs(playing) do
	for _,x in pairs(playing) do
		if v.Votes.Value == x.Votes.Value then
			if v.Votes.Value ~= 0 and x.Votes.Value ~= 0 then
				print("equal")
				tie = true
			end
		end	
	end
end	

My problem is that when there are 3 players, one of them has 1 vote and others have 0 it still prints equal once and tie sets to true and I cant figure out why it does that... Any ideas?

Thank you.

1 answer

✓ Accepted answer

See if this helps:

for i,v in pairs(playing) do
	for _,x in pairs(playing) do
	if v.Votes.Value == x.Votes.Value and v.Name ~= x.Name  then
		if v.Votes.Value ~= 0 and x.Votes.Value ~= 0 then
			if v.Votes.Value ~= 0 and x.Votes.Value ~= 0 then
			tie = true
			end
		end
	end
end

It kind of happened because v and x are the same thing (I think) and the script I have given will help.

1 comment

1

Oh, yea that worked, my brain isn't working today lol, thanks

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