"attempt to compare number to boolean"

  1. I am trying to make a voting gui. There are two text buttons, one called, “Forgive”, and one called "Blame"

  2. Screen Shot 2021-07-25 at 11.35.27 AM

  3. I tried looking on devforum and youtube but that didn’t do anything.

In a script there is an intvalue that changes when you press a text button and I am trying to compare the numbers of them to do the endings.

We can’t help if you don’t show us the code that is erroring

1 Like

Sorry, I forgot to do that, here:

Please provide it in a code block instead for better readability and the full block of code if possible

not has priority over other operators, it’s converting the first value into a boolean, remove the not and change the > into <= for what you want, or just encase everything between not and then in brackets

This is pretty simple to fix, put parentheses around Gui.VoteGui.Frame.Forgive.NumberValue.Value > Gui.VoteGui.Frame.Blame.NumberValue.Value.

if not (Gui.VoteGui.Frame.Forgive.NumberValue.Value > Gui.VoteGui.Frame.Blame.NumberValue.Value) then
2 Likes

but now it only displays the good ending: if Gui.VoteGui.Frame.Forgive.Text >= Gui.VoteGui.Frame.Blame.Text then

I think in your case you have to do <= not >=, because you wanted the inverse of >

I tried it and it still doesn’t work.

Are you still there? I need to fix this problem ASAP or I might get fired.

How is the line currently written?

Sorry. I dont get what you mean by that.

The line that is causing issues, how does it look like currently?

elseif Gui.VoteGui.Frame.Forgive.NumberValue.Value <= Gui.VoteGui.Frame.Blame.NumberValue.Value then

Elseif? It was an if statement before, what’s the full if-else?

The forgive button line said if Gui.VoteGui.Frame.Forgive.NumberValue.Value >= Gui.VoteGui.Frame.Blame.NumberValue.Value then

If that’s the if, then you can just turn the elseif into an else

if Gui.VoteGui.Frame.Forgive.NumberValue.Value >= Gui.VoteGui.Frame.Blame.NumberValue.Value then
    --Good ending
else
    --Bad ending
end

I’ll test to see if this works.

Still doesn’t work :frowning: no errors in output either.

try

elseif Gui.VoteGui.Frame.Forgive.NumberValue.Value > Gui.VoteGui.Frame.Blame.NumberValue.Value == false then