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

Why is there an error here? The code seems perfectly fine

Asked by 4 years ago

I'll just give ya the code here

1   if p.Position.Y > -200 then
2           x = p.Position.Y        
3               elseif p.Position.Y < -200 then
4                   x = 200
5                       end
6                   
7                                               
8   local asphalt = Instance.new("Part")
9   asphalt.Anchored =true
10  asphalt.CanCollide=false
11  print(x)
12  asphalt.Size = Vector3.new(p.Size.X, (-1*math.random(100-100,x-100))- -1000, p.Size.Z)
13  asphalt.Position = Vector3.new(p.Position.X,-1000 + asphalt.Size.Y/2,p.Position.Z)
14  workspace.Terrain:FillBlock(asphalt.CFrame, asphalt.Size,Enum.Material.Asphalt)

At line 12 I get the error

bad argument #2 to 'random' (interval is empty)

At line 11 I get

-114.92626190186

This code seems perfectly fine, what's the problem here?

1
at one point arg #2 in less than #1 thefore erroring an empty interval, or x-100 is extremely large Fifkee 2017 — 4y
0
Thank you, that worked. I wrote an if statement and everything is fine now. Poolie32006 40 — 4y

Answer this question