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

How to check if an IntValue is between two numbers?

Asked by
JJ_B 250 Moderation Voter
9 years ago

I'm making a surface GUI that checks an Integer Value to see if it's between two certain numbers and then changes its colour. I just have no idea to check if something is between two numbers. Can anyone help?

Here is my script (I used x - y for the between bits, but I know this will subtract instead)

while true do
    if game.Workspace.Shields.Value <= 10 then
        script.Parent.TextColor3 = Color3.new(255,0,0)
    elseif game.Workspace.Shields.Value == 11 - 50 then
        script.Parent.TextColor3 = Color3.new(255,150,0)
    elseif game.Workspace.Shields.Value == 51 - 90 then
        script.Parent.TextColor3 = Color3.new(255,255,0)
    elseif game.Workspace.Shields.Value == 91 - 100 then
        script.Parent.TextColor3 = Color3.new(0,255,0)  
    end
    wait(0.3)
end

Answer this question