So, I know that this type of question has been answered but none of that helped me!! :(
Here is the error: bad argument #2 to 'random' (interval is empty)
The reason is that I am making an SCP game with my friend, and for SCP-173, I need a random tp script. What I have so far is a specified grid on where it can move.
Here is the script:
-- // Developed By BabyDevil285 \\ -- -- // Variables local scp = script.Parent local torso = scp.Torso local hum = scp.Humanoid local movementgrid = workspace.SCP_173_MovementGrid local scpXmovement = math.random(-565, -595) local scpZmovement = math.random(148, 188) -- // Functions local function Slide() torso.Position = Vector3.new(scpXmovement, 0, scpZmovement) end -- // Slide Event while true do wait(math.random(4, 17)) Slide() end -- // Kill Event -- Soon.
The line of error: 9
Please help!!
bad argument #2 to 'random' (interval is empty) usually occurs when the first argument is larger than the second. -595 is less than -565.
Instead at line 9, do:
local scpXmovement = -math.random(565, 595)
OMG!! CREDIT GOES TO RedcommanderV2 FOR ANSWERING MY QUESTION!! I'VE BEEN TRYING TO FIXURE THIS OUT THE WHOLE NIGHT YESTERDAY. THIS MEANS A LOT TO ME :DDDDDD