I have this script for my car spawner that is meant to spawn cars on a different z coordinate so they don't spawn together. Here it is:

game.ReplicatedStorage.BuyCars.BuyCar1.OnServerEvent:Connect(function(player)
	if player.leaderstats.Cash.Value >= 3500 then
		
		if not player.Character:FindFirstChild("Car1") then
		player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - 3500
		wait()
		 local Car = game.ServerStorage.Folder.Car1:Clone()
		local number = math.random(-42, -140)
				
		Car:SetPrimaryPartCFrame(CFrame.new(-43.055, 3, number))
		Car.Parent = player.Character
		Car:MakeJoints()
		
		end
	end
end)

I keep getting this on line 8:

23:22:18.820 - ServerScriptService.BuyCars.Script:8: bad argument #2 (interval is empty)

What does this mean? I defined what the number should be.

2 comments

1

try math.random(-140,-42)

0

It worked thanks I forgot it has to be (min, max)