Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Getting Error: "ServerScriptService.Script:8: bad argument #2 to 'random' (interval is empty)"?

Asked by
Akkoza 0
4 years ago
Edited 4 years ago

I can run this sometimes, and it will work, but it will only generate parts on the outside of the brick (but if I shrink it it generates fine?)

Code:


local spawnBase = workspace.Baseplate local point1 = Vector2.new(-spawnBase.Position.X-(spawnBase.Size.X/2),spawnBase.Position.Z+(spawnBase.Size.Z/2)) local point2 = Vector2.new(spawnBase.Position.X+(spawnBase.Size.X/2),-spawnBase.Position.Z-(spawnBase.Size.Z/2)) local point3 = Vector2.new(-spawnBase.Position.X+(spawnBase.Size.X/2),-spawnBase.Position.Z-(spawnBase.Size.Z/2)) local point4 = Vector2.new(spawnBase.Position.X-(spawnBase.Size.X/2),spawnBase.Position.Z+(spawnBase.Size.Z/2)) local randomX = math.random(point1.X,point4.X) local randomZ = math.random(point1.Y,point3.Y) local part = Instance.new("Part"); part.Parent = workspace part.Anchored = true part.CFrame = CFrame.new(randomX,spawnBase.Position.Y+(spawnBase.Size.Y/2),randomZ)

Error: "ServerScriptService.Script:8: bad argument #2 to 'random' (interval is empty)"

0
Remove the "Code:" so we can see the actual code better. bluzorro 417 — 4y
0
my bad, it doesnt work on the same line as text Akkoza 0 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

At line 8








local randomZ = math.random(point1.Y,point3.Y)

point1.Y is higher than point3.Y

The first argument of math random will be the minimum number and the second the maximum

0
ah, I must not have saved my changes when I had it fixed originally, thanks! Akkoza 0 — 4y
0
If an answer has solved your problem please use the "accept answer" feature. EpicMetatableMoment 1444 — 4y
Ad

Answer this question