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

[Solved]Why wont this piece of code detect the IntValue using variables?

Asked by 9 years ago
a = script.Votingstatus1.Value
b = script.Votingstatus2.Value
c = script.Votingstatus3.Value

    if a > b and a > c then
        print "a wins"
    elseif
        b > a and b > c then
        print "b wins"
    elseif
        c > a and c > b then
        print "c wins"
    elseif
        print"?" then
    end

The piece of code won't detect the value of the IntValue

Votingstatus1, 2, and 3 is the IntValue

1 answer

Log in to vote
1
Answered by
Voltoxus 248 Moderation Voter
9 years ago

Well one problem I see would be you putting the comparison statement under the "elseif" instead of on the same line, and the "then" should also be on the same line.

Another problem I see is the last "elseif" should be else.

Here the corrected code:

local a = script.Votingstatus1.Value
local b = script.Votingstatus2.Value
local c = script.Votingstatus3.Value

if a>b and a>c then
    print "a wins"
elseif b>a and b>c then
    print "b wins"
elseif c>a and c>b then
    print "c wins"
else
    print "?"   
end
0
Thanks rabidhalofan12345 55 — 9y
0
np Voltoxus 248 — 9y
Ad

Answer this question