Want to shorten script using or instead of repeating

local Time = Time1.Value or Time2.Value
if Time == 1 then
elseif Time == 2 then
elseif Time == 3 then
end

However it only gets the first value which is Time1

I have a solution but do not want to use it as there will be many more values is there anyway to make the above script work?

e.g
if Time1.Value == 1 or Time2.Value == 1 then
elseif Time1.Value == 2 or Time2.Value == 2 then
end

personally. I’d do something else. I’d do this:

local Calls = {};

Calls[1] = function(...)

end

function OnCalled(Time, ...)
    if Calls[Time] then 
        return Calls[Time](...);
    else
        return error("Invalid call: ", tostring(Time));
    end
end

You could add the values together and go based on the results, like so:

local function GetTimeValues()
	return Time1.Value + Time2.Value
end

local getValues = GetTimeValues()
if getValues <= 2 then
	-- Time1 == 1 stuff
elseif getValues <= 4 then
	-- Time1 == 2 stuff
end

however this would only work if you are comparing all values at once. if you only need just 1 of the values to be a certain number, it is best to just do a normal value check.