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

[ANSWERED] Why does the first IF work no matter what?

Asked by 5 years ago
Edited 5 years ago
    local event = Instance.new("RemoteEvent")
        event.Parent = game.ReplicatedStorage
    event.Name = "Level"
local player = game:GetService("Players")
game.ReplicatedStorage.Level.OnServerEvent:connect(function(player)
    local PStats = player:WaitForChild("PStats")
    local Layer = PStats.Layer
    local TLayer = PStats.TLayer
    if Layer.Value < 10000 and TLayer.Value ~= 0 
    or Layer.Value < 20000 and TLayer.Value ~= 1 or
     Layer.Value < 40000 and TLayer.Value ~=2 or
      Layer.Value < 200000 and TLayer.Value ~= 3 or 
       Layer.Value < 400000 and TLayer.Value ~=4 or
        Layer.Value < 300000 and TLayer.Value ~= 5
    then
        print "Not Worthy!"
    else
        if Layer.Value >= 10000 and TLayer.Value == 0 
    or Layer.Value >= 20000 and TLayer.Value == 1 or
      Layer.Value >= 40000 and TLayer.Value ==2 or
      Layer.Value >= 200000 and TLayer.Value == 3 or 
       Layer.Value >= 400000 and TLayer.Value ==4 or
         Layer.Value >= 300000 and TLayer.Value == 5
    then
print "Worthy"

Layer.Value = 1
TLayer.Value = TLayer.Value + 1
wait(.2)
    end
    end
end)


The issue is that no matter what it only prints not worthy

0
Operator precedence, you might need some parentheses User#24403 69 — 5y
0
Try printing your Layer and TLayer values, make sure those are what you think they are. DinozCreates 1070 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

@Incapaxian Answered this, I can't put him to answer though so here is this post

Ad

Answer this question