Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is this happening?ServerScriptService.Script:7: bad argument #2 to 'random' (interval is empty)

The code is Starts Here:

local explosionPart = game.ServerStorage.ExplosionPart local explosionPartDropHeight = 100

local function createExplosionPartCopy() local explosionPartCopy = explosionPart:Clone() explosionPartCopy.Parent = game.Workspace local xPosition = math.random(440, 292) local zPosition = math.random(440, 292) explosionPartCopy.Position = Vector3.new(xPosition, explosionPartDropHeight, zPosition) end

while true do createExplosionPartCopy() wait (0.7) end

Ends Here. After i run it comes up with this: ServerScriptService.Script:7: bad argument #2 to 'random' (interval is empty) Pls someone help.

2 comments

0

Format your code in Lua Code block.

0

And accept his answer

1 answer

✓ Accepted answer

You have to have the smallest number first, and the largest number second.

math.random(292, 440)

1 comment

0

omg thank you sooo much

This discussion is preserved as it was. New answers, comments, and votes are closed.