while true do luis = Instance.new("Part",workspace) luis.Size=Vector3.new(5,1,5) workspace.Part.Position=Vector3.new(math.random(252.5,138.5), math.random(-18.5,-18.5), math.random(-252.5,-137.5)) workspace.Part:Destroy() wait(2) end
so when i try to run this rng for a instanced part, it gives me this in the output 16:06:44.136 - ServerScriptService.Script:4: invalid argument #2 to 'random' (interval is empty) plz help!
You're doing:
math.random(-18.5, -18.5)
Which is pretty useless. Same goes with:
math.random(252.5,138.5)
You're starting for max to min, supposed to be the other way around.
I suggest using the function:
local function random(min, max) return math.random() * (min - max) + min end
instead, returns any number from min to max (usually this will not be an integer). So now you can use it like:
random(1, 5)
Also you're not supposed to Parent luis until you are done modifying its properties. (efficiency reasons) - that's why they deprecated the 2nd parameter of Instance.new.