This is supposed to be a script that randomly clones a model and puts them on a random z postion, but i get this error “ServerScriptService.Script:3: invalid argument #2 to ‘random’ (interval is empty)” im not very good with lua i know the basics, and other stuff.
for i = 1, 50 do
local rr = math.random(-47.75, -3993.75)
local f = game.ServerStorage.Folder.Mo:Clone()
f.Parent = game.Workspace
f.PrimaryPart.Position = Vector3.new(44, 5.25, rr)
end
you should swap the order of the bounds so that the lower bound is less than the upper bound
upper bound (-3993.75) is less than the lower bound (-47.75).
for i = 1, 50 do
local rr = math.random(-3993.75, -47.75)
local f = game.ServerStorage.Folder.Mo:Clone()
f.Parent = game.Workspace
f.PrimaryPart.Position = Vector3.new(44, 5.25, rr)
end
Yes aslong as the PrimaryPart on your model is Frames but, Could you click on the empty field of primary part and then when you see a red cross, click on the frames union so that it will make the primarypart “Frames”
You should get a black cursor with a part next to it
for i = 1, 50 do
local rr = math.random(-3993.75, -47.75)
local f = game.ServerStorage.Folder.Mo:Clone()
f.Parent = game.Workspace
f.PrimaryPart.Position = Vector3.new(44, 5.25, rr)
end
The numbers must be whole numbers for reliable behavior. The script wouldn’t know the depth of the random number you want, so use whole numbers instead. You can multiply the range by a factor of 10 and divide it the same way after to make it generate random decimals.
Thanks with a bit of tweaking/ 1 line i made so the touch part also is in the right place,
for i = 1, 50 do
local rr = math.random(-3993.75, -47.75)
local f = game.ServerStorage.Folder.Mo:Clone()
f.Parent = game.Workspace
f.PrimaryPart.Position = Vector3.new(44, 5.25, rr)
f.Touch.Position = Vector3.new(44, 5.25, rr)
end