So basically i am having absolutely unacceptable issues with if statements that just doesn’t work as expected
For example:
if the number that is getting passed into my code is positive like 950 its gonna return the correct result
BUT
if the number is negative like -2000 its gonna return NIL.
if someone could help me i would appreciate it i just cannot figure out the issue(s)
local module = {}
function module:Get()
local result = nil
local coreTemp = game.ReplicatedStorage.CoreTemp.Value
if coreTemp <= -4000 then
result = "FREEZEDOWN"
elseif coreTemp < -2000 then
result = "TOO COLD"
elseif coreTemp >= -1999 and coreTemp <= 949 then
result = "NORMAL"
elseif coreTemp >= 950 and coreTemp <= 2600 then
result = "CRITICAL"
elseif coreTemp >= 2600 and coreTemp <= 3999 then
result = "OVERHEAT"
elseif coreTemp >= 4000 then
result = "MELTDOWN"
end
return result
end
return module
Srry, but i still dont understand what is your problem?
Is the module script doesnt work or what?
usually i’ll type the function like this
function module.Get()
so i can require the module script other module
local moduleScript = require(--The position of module script)
modulescript.Get()
and you can get the return like this
local moduleScript = require(--The position of module script)
local temp = modulescript.Get() --temp variable will save return value of the module script
print(temp) -- its should print the temperature status
if its a . or : doesnt affect if the script is gonna run the two dots just doesnt have autocompletion but yeah basically the module returns the correct status only if the temp is positive even if it checks for negativity