function CloneMeteor() local Meteor = game.ServerStorage.Fireball local Clone = Meteor:Clone() local xPos = math.random(21, -21) -- Error comes on this line local yPos = 20 local zPos = math.random(99, -99) Clone.Parent = workspace Clone.Position = Vector3.new(xPos, yPos, zPos) end
Whenever I run this code in a test server I get this error: bad argument #2 to 'random' (interval is empty)
I'm not sure what this means, I'm running this as a ServerScript in ServerScriptService. If anyone could help me that'd be great, thanks!
math.random
starts with the small number and end with the bigger number, not big to small like you have it.
This is causing your script to error:
local xPos = math.random(21, -21)
This is also causing your script to error:
local zPos = math.random(99, -99)
You should change those two lines of code to be this instead:
local xPos = math.random(-21, 21) local zPos = math.random(-99, 99)
Full script:
function CloneMeteor() local Meteor = game.ServerStorage.Fireball local Clone = Meteor:Clone() local xPos = math.random(-21, 21) -- Error comes on this line local yPos = 20 local zPos = math.random(-99, 99) Clone.Parent = workspace Clone.Position = Vector3.new(xPos, yPos, zPos) end