Workspace.Tree.Script:5: invalid argument #2 to 'random' (interval is empty)

When I launch this script it gives “Workspace.Tree.Script:5: invalid argument #2 to ‘random’ (interval is empty)”

Can someone tell why and give solution?

local X, Y, Z = script.Parent.Size.X, script.Parent.Size.Y, script.Parent.Size.Z

while task.wait(math.random(20, 60)) do
	local apple = game.ServerStorage.AppLe:Clone()
	apple.Handle.Position = Vector3.new(math.random(script.Parent.Size.X, -script.Parent.Size.X), Y, math.random(script.Parent.Size.Z, -script.Parent.Size.Z))
	apple.Parent = workspace
end

The first argument in math.random must be smaller than the second argument, which isn’t the case since you put the negative size as the second argument.

1 Like

Ah I realized now. Thanks for answering

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.