Hello I'm Having A Error In My Code That I Don't Understand. I Making A Bomb Survival Admin Command And i Want it To Drop Bombs From The Sky And Spawn At A Random Position. I'm Not Sure What Can be Causing It. The Minus Symbol? The Decimals? I'm Not Sure What I Can Be Please Leave Your Suggestions down below.
local RandomZ = math.random(172,-104.6) warn("The Z Location Of The Next Bomb is".. RandomZ)
Simple, you have to put the smaller number first.
local RandomZ = math.random(-104.6, 172)
This may or may not work, but what I find that fixes it, is adding another .. collum after randomz, and they placing quotes with a period. Kind of like this. I fixed it. Also, you can't already set a value, it has to be empty
local RandomZ = math.random() warn("The Z Location Of The Next Bomb is " .. RandomZ .. ".")
Your parameters are wrong, the first parameter must be the minimum and the 2nd must be a maximum. Example: math.random(10, 100)
When doing the marh.random(), your answers must be in order. I made this nifty function:
function order(a,b) if a<b then return a,b else return b,a end end math.random(order(172,-104.6))
As long as a and b are real numbers, you won't have that error.